Algorithms
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.
Step 1/62 Bubble sort: scan left→right, swap adjacent pairs if out of order. Largest "bubbles" to the end each pass.
| Pass | j | a[j] | a[j+1] | Action |
|---|---|---|---|---|
| Press Play or Step → to see trace | ||||
| Algorithm | Best case | Worst case | Space |
|---|---|---|---|
| Bubble Sort | O(n) | O(n²) | O(1) |
| Insertion Sort | O(n) | O(n²) | O(1) |
| Linear Search | O(1) | O(n) | O(1) |
| Binary Search | O(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.