Oh My Algorithm
Algorithm Guidecomplexity: O(n log n)

Quick Sort

A fast, efficient divide-and-conquer algorithm that sorts by partitioning the array around a pivot. It underlies the built-in sort in most languages.

01 Explore How It Works

Interactive Step-by-Step
Quick Sort
38
27
43
10
76
15

퀵 정렬을 시작합니다. 피벗은 항상 마지막 요소를 선택합니다.

Logic Node1 / 26

02 Understand It Simply

For Everyone
🔑Analogy

Pick a pivot, split into a 'smaller' and 'larger' side, then split each side again.

💡In Plain Words

Partitions values smaller than the pivot to the left and larger to the right, then sorts recursively.

Averages O(n log n) — very fast.

📍Where It's Used
  • General-purpose sorting (most standard libraries)
  • large datasets

03 Python Implementation

A clean, readable reference implementation of the core logic of Quick Sort.

core_implementation.py
def quick_sort(arr, low, high):
    if low < high:
        pi = partition(arr, low, high)
        quick_sort(arr, low, pi - 1)
        quick_sort(arr, pi + 1, high)

def partition(arr, low, high):
    pivot = arr[high]
    i = low - 1
    for j in range(low, high):
        if arr[j] <= pivot:
            i += 1
            arr[i], arr[j] = arr[j], arr[i]
    arr[i+1], arr[high] = arr[high], arr[i+1]
    return i + 1

04 Frequently Asked Questions

FAQ
What is Quick Sort?+

A fast, efficient divide-and-conquer algorithm that sorts by partitioning the array around a pivot. It underlies the built-in sort in most languages.

What is the time complexity of Quick Sort?+

The time complexity of Quick Sort is O(n log n). Follow the step-by-step visualization to see exactly why.

Where is Quick Sort used?+

General-purpose sorting (most standard libraries), large datasets.

What's a simple analogy for Quick Sort?+

Pick a pivot, split into a 'smaller' and 'larger' side, then split each side again.

Guide Progress0%