← Back to projects

Sorting Visualizer

Watch eight sorting algorithms run, step by step, with their complexity on screen.

HTMLCSSJavaScript
Sorting Visualizer screenshot

The problem

Sorting algorithms are easy to memorise and hard to understand from code alone. The goal was a tool where you can see exactly what each algorithm does, at a speed you control.

Approach

  • Visualises bubble, selection, insertion, merge, quick, heap, counting and tim sort.
  • Uses colour for meaning: blue is default, yellow is being compared, red is out of place, green is in its final position.
  • Lets users set the array size and speed, generate random arrays, or type their own comma-separated input.
  • Shows best, average and worst time complexity and space complexity next to each run.

Results

  • Eight algorithms in a single dependency-free web page.
  • Live on GitHub Pages, so anyone can try it with no setup.

At a glance

Algorithms covered
AlgorithmAverage time
Bubble sortO(n²)
Selection sortO(n²)
Insertion sortO(n²)
Merge sortO(n log n)
Quick sortO(n log n)
Heap sortO(n log n)
Counting sortO(n + k)
Tim sortO(n log n)

Standard average-case time complexity. The app also shows best, worst and space complexity for each.