All tools

Algorithms

Algorithm Visualiser

Watch sorting and searching algorithms execute step-by-step. Each step shows exactly what's happening, with a live trace table — just like an exam question.

AQA GCSEOCR GCSECambridge IGCSEA Level
Algorithm:
5
0
2
1
8
2
1
3
9
4
3
5
7
6
4
7
Comparing Swapping Sorted Active key

Step 1/62 Bubble sort: scan left→right, swap adjacent pairs if out of order. Largest "bubbles" to the end each pass.

Speed:

Trace table (last 0 steps)

Passja[j]a[j+1]Action
Press Play or Step → to see trace

Complexity reference

AlgorithmBest caseWorst caseSpace
Bubble SortO(n)O(n²)O(1)
Insertion SortO(n)O(n²)O(1)
Linear SearchO(1)O(n)O(1)
Binary SearchO(1)O(log n)O(1)

Exam tip: Binary search requires a sorted array. Bubble and insertion sort are O(n) best case when the array is already sorted (with early termination). You need to know these time complexities for GCSE and A Level.

Related revision