🔢 How to Put Lists in Order — Sorting Algorithms

When you search on Amazon, it sorts millions of products in milliseconds. Watch how different sorting algorithms work step by step and compare their speed.

Designed with the WJEC specification in mind

🤔 What are sorting algorithms?

Sorting algorithms arrange lists in order (like alphabetical or numerical). Each algorithm has a different strategy — some are simple but slow, others are complex but fast. Computers use fast ones for big datasets!

🍕 Analogy: It's like organizing your bookshelf. You could move one book at a time (bubble sort) or use smarter strategies like dividing books into piles and combining them (merge sort)!
⚙️

Controls

30
50
Default
Comparing
Swapping
Pivot
Sorted
Press Play to start or Step to go one operation at a time.
💡

Bubble Sort

BestO(n)
AverageO(n²)
WorstO(n²)
SpaceO(1)
Stable ℹ️Yes
In-place ℹ️Yes

Repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass is repeated until the list is sorted.

📊

Statistics

Comparisons0
Swaps0
Accesses0
StatusReady
📝

Exam Tips

  • GCSE: Know bubble sort and be able to trace through a small example
  • A-Level: Compare time complexities: bubble/selection O(n²), merge/quick O(n log n)
  • Key point: Stable sorts preserve the order of equal elements
  • Remember: In-place sorts use less memory but may be slower