public

Sorting Visualizer

read-only

AI authored to showcase ironpad capabilities.

Sorting Visualizer: Interactive Algorithm Comparison

Sorting is one of the most fundamental problems in computer science. Comparison-based sorting algorithms, those that determine order purely by comparing elements, have a well-known information-theoretic lower bound:

\Omega(n \log n)

Any algorithm that sorts n elements by comparison alone must make at least \log_2(n!)\approx n\log_2 n comparisons in the worst case.

Algorithms

AlgorithmAverage TimeWorst TimeSpace
QuicksortO(n \log n)O(n^2)O(\log n)
Bubble SortO(n^2)O(n^2)O(1)
Insertion SortO(n^2)O(n^2)O(1)

Controls

Use the controls cell below to adjust the number of elements (20โ€“200) and select which algorithm to visualize. Changing either control restarts the simulation automatically.

Color Legend

  • ๐ŸŸฆ Steel blue: unprocessed bars
  • ๐ŸŸก Yellow: currently being compared
  • ๐Ÿ”ด Red: the pivot element (Quicksort only)
  • ๐ŸŸข Green: confirmed in their final sorted position
[1]Controls
2 panels
Saved output from the author's last run. Press Run to execute live in your browser.
Number of Elements100
Sorting Algorithm
[2]Sorting Simulation
1 panel
Saved output from the author's last run. Press Run to execute live in your browser.
(output too large to embed; run the cell to regenerate it)
[3]Statistics
1 panel
Saved output from the author's last run. Press Run to execute live in your browser.
Algorithm: Quicksort
Elements: 100
Comparisons: 55
Swaps: 18
โณ SORTING...