# Quick sort Python code you can run

> Run quick sort Python code, inspect its pivot, and compare the quick sort algorithm with earlier sorts.

Source: https://fullbytedeveloper.com/blog/quick-sort-pivot-worst-case
Keyword: QUICK
Published here: 2026-11-23

I built this quick sort level so you can inspect its pivot. The repository documents the same terminal command used by the level [1].

## Run quick sort Python code

```bash
python3 quick_sort.py
```

You should see the pivot reach a final position, then both remaining sides sort.

## Run quick sort's ordered-row weak case

```bash
python3 quick_sort.py 1 2 3 4 5 6 7 8
```

You should see the stage-clear row remain `1 2 3 4 5 6 7 8` and print compare and swap counters.

## Race quick sort with the other sorting levels

The arcade races every current sorting level on the same shuffled 10,000-number row. It runs each plain sorting function three times and prints the median time [1].

```bash
python3 arcade.py --race 10000
```

You should see Bubble sort, Selection sort, Insertion sort, Merge sort, Quick sort, and Heap sort with a time and extra-memory line.

## Inspect the quick sort algorithm pivot

This level chooses its last value as the pivot [2]. [Bubble sort swaps neighbors](/blog/bubble-sort-python), [selection sort places the smallest value](/blog/selection-sort-python), [insertion sort grows a prefix](/blog/insertion-sort-python), and [merge sort writes an extra row](/blog/merge-sort-python). Run [heap sort's predictable pyramid](/blog/heap-sort-python) next, or browse [Dev explainers](https://fullbytedeveloper.com/blog/topic/dev-explainers).

Send this to the friend who wants to inspect a quick-sort pivot.

## Sources

1. [ALGO ARCADE README](https://github.com/kamilikamil/algo-arcade/blob/main/README.md)
2. [ALGO ARCADE quick sort source](https://github.com/kamilikamil/algo-arcade/blob/main/quick_sort.py)
