Quick Sort Visualizer

About Quick Sort

Quick Sort is a highly efficient sorting algorithm that uses a divide-and-conquer strategy. It works by selecting a 'pivot' element and partitioning the other elements into two sub-arrays according to whether they are less than or greater than the pivot.

Core Concepts

  • Divide and Conquer: Partitions array around a pivot element
  • In-place: Requires O(log n) additional space for recursion
  • Unstable: May not preserve relative order of equal elements
  • Time Complexity: O(n log n) average case, O(n²) worst case
  • Cache Efficient: Good locality of reference
  • Best for: Large datasets with good average performance

Quick Sort is generally faster than merge sort in practice due to better cache performance, despite having a worse worst-case time complexity. The algorithm's performance heavily depends on pivot selection strategy.

depth 0 1 2 3 4+

Visualization

Pseudocode


                        

Statistics

    Controls

    Playback