ALGORITHM SIMULATION

An already-sorted list is the worst case for the algorithm called quicksort: with the pivot taken at the end of the range, each partition peels off a single element and the comparison count shoots up to roughly n²/2, no better than bubble sort. Let the pivot land near the middle and the very same algorithm returns to O(n log n). Merge sort holds O(n log n) always and never reorders equal elements, at the price of a borrowed array of size n. On a sorted list, binary search halves the range at every step for O(log n), even when the value is not there at all.

▸ Generating a random number array & maze grid…
▸ Loading sorts (bubble · quick · merge)
▸ Loading pathfinding (BFS · A* · binary)
▸ Hashing discrete steps for replay
▸ Calibrating comparison & swap counters…
▸ Ready — Online. ✅
0%
⌂ Mind & Machine

Simulation room Algorithms

Sorting & Pathfinding
Online
step-by-step · Big-O · visual
Progress & cost
🫧 Bubble sort
Comparisons—
Swaps / moves—
Steps—
Completed—
Complexity—
Viewing—
Notes
An algorithm is a clear sequence of steps that solves a problem. The same task (sorting / pathfinding) has many approaches — differing in the number of operations they take, i.e. the Big-O complexity.
—
Pick a ‘Scenario’ to switch algorithm (bubble · quick · merge · BFS · A* · binary) · 🔀 reshuffle to watch it run again · click a concept for details
Your browser has canvas disabled.
Cumulative comparisons over time comparisonsswaps/moves
About Algorithms

An already-sorted list is the worst case for the algorithm called quicksort: with the pivot taken at the end of the range, each partition peels off a single element and the comparison count shoots up to roughly n²/2, no better than bubble sort. Let the pivot land near the middle and the very same algorithm returns to O(n log n). Merge sort holds O(n log n) always and never reorders equal elements, at the price of a borrowed array of size n. On a sorted list, binary search halves the range at every step for O(log n), even when the value is not there at all.

Related topics in Mind & Machine