đŹ
Sorting Visualizer
Watch sorting algorithms in action. Compare how different approaches tackle the same data â see the comparisons, swaps, and patterns that make each algorithm unique.
Related OCaml files:
mergesort.ml,
sorting.ml
Merge Sort
Divide-and-conquer: split array in half, recursively sort each half, merge results. Stable and predictable.
Best:
O(n log n)
Average: O(n log n)
Worst: O(n log n)
Space: O(n)
60
Comparisons
0
Array Accesses
0
Time
0.0s
How to Use
- Pick an algorithm and array size
- Click Start to begin the animation
- Watch the bars: red = comparing, yellow = pivot, green = sorted
- Adjust speed mid-animation, or pause to study a step
- Try the same array with different algorithms to compare!