Intermediate 25 min

Interactive Visualization

Watch quick sort work in real-time. The visualizer shows partitioning and recursive sorting.

Quick Sort Visualization

1x

What to Observe

As you watch the visualization, notice:

  1. Pivot selection: Pivot is highlighted
  2. Partitioning: Elements are rearranged around pivot
  3. Recursion: Process repeats for sub-arrays
  4. Base case: Single elements are already sorted
  5. Final result: Array is completely sorted

Understanding the Colors

  • Orange/Yellow: Pivot element
  • Blue/Cyan: Elements being compared
  • Green: Elements in correct position
  • Red: Elements being swapped

Try Different Arrays

The visualizer shows how quick sort:

  • Partitions around pivot
  • Recursively sorts sub-arrays
  • Achieves O(n log n) average performance

What’s Next?

Now that you’ve seen it work, let’s implement quick sort in code.