Lab
Sorting Algorithm Race
Four sorting algorithms race on identical data. Bubble sort and insertion sort compare neighbours one at a time—painfully slow on large arrays. Merge sort and quicksort divide and conquer, finishing in a fraction of the steps. The difference between O(n²) and O(n log n) is not abstract here: you can see it happen.
Unsorted
Comparing
Swapping
Sorted
Bubble Sort
Comparisons: 0 Swaps: 0
Done
Insertion Sort
Comparisons: 0 Swaps: 0
Done
Merge Sort
Comparisons: 0 Writes: 0
Done
Quicksort
Comparisons: 0 Swaps: 0
Done