Quick Sort — Algorithm Visualizer

Step 1:Initial array. Quick Sort will pick a pivot and partition the array around it.

Quick Sort

Intermediate
Time Complexity
O(n²)O(n log n)O(n)O(log n)O(1)n →
Best: O(n log n)
Avg: O(n log n)
Worst: O(n²)

Quick Sort is a highly efficient, divide-and-conquer sorting algorithm. It works by selecting a "pivot" element and partitioning the array around it.

How it works:

1. Choose a pivot element (here, the last element)
2. Partition: rearrange so elements smaller than pivot are on the left, larger on the right
3. The pivot is now in its final sorted position
4. Recursively apply to the left and right sub-arrays

Time Complexity:

Best: O(n log n)
Average: O(n log n)
Worst: O(n²) — when pivot is always the smallest/largest

Space Complexity: O(log n) average, O(n) worst — recursive call stack

Properties:

  • Not stable
  • In-place (with Lomuto partition)
  • Cache-friendly

Quick Sort is one of the fastest general-purpose sorting algorithms in practice. Used in many standard library implementations.

Related algorithms

Frequently asked questions

What is Quick Sort?
Quick Sort is a highly efficient, divide-and-conquer sorting algorithm. It works by selecting a "pivot" element and partitioning the array around it.
What is the complexity of Quick Sort?
Time (average): O(n log n) · Space: O(log n)
Who is this Quick Sort visualizer for?
The Quick Sort visualization targets intermediate-level learners in the Sorting category. Useful for students, interview prep, and hands-on review.
What algorithms are related to Quick Sort?
In the same category (Sorting) you can explore: Bubble Sort, Selection Sort, Insertion Sort. Each has an interactive visualization.