Algorithm

A set of step-by-step instructions a computer follows to solve a problem.

Sorting Algorithm

A set of instructions to arrange a list of items into a specific order.

Bubble Sort

Compares adjacent items and swaps them if they are in the wrong order, repeating until the list is sorted.

Quick Sort

Picks a 'pivot' element and partitions the other elements into two sub-arrays, according to whether they are less than or greater than the pivot.

Insertion Sort

Builds the final sorted list one item at a time, by taking one item and inserting it into its correct position in the already sorted part.

Searching Algorithm

A method used to find a specific item within a collection of data.

Serial/Linear Search

Checks each item in a list one by one, from the beginning, until a match is found or the end of the list is reached.

Binary Search

Repeatedly divides the search interval in half to find an item. It only works on a sorted list.

Stacks

A data structure that follows the Last-In, First-Out (LIFO) principle.

Queues

A data structure that follows the First-In, First-Out (FIFO) principle.

LIFO

Stands for Last-In, First-Out. The last item added is the first item to be removed.

FIFO

Stands for First-In, First-Out. The first item added is the first item to be removed.

Pivot Element

The element chosen in the Quick Sort algorithm to help partition the list.

Condition for Binary Search

The list of data must already be sorted.

Stack Analogy

A stack of plates - you take the top one off first.

Queue Analogy

A line of people waiting - the first person in line is the first person served.

Main Algorithm Categories

Sorting and Searching.

Input Validation

The process of checking if data entered by a user meets certain criteria before it is processed.

Count Occurrences

An algorithm to count how many times a specific item appears in a list.

Adding to a Queue

Items are added to the back (end) of the queue.

Removing from a Queue

Items are removed from the front of the queue.

Adding to a Stack

Known as 'Pushing'. Items are added to the top of the stack.

Removing from a Stack

Known as 'Popping'. Items are removed from the top of the stack.

Efficiency of Bubble Sort

It is simple to understand but not very efficient for large lists.

Efficiency of Binary Search

Very efficient for searching large, sorted lists because it halves the search area with each step.