AI engineering glossary · Data structures algorithms
What is quicksort?
Quicksort: A divide and conquer sorting method that picks a pivot, moves smaller items before it and larger items after it, then sorts each side recursively. It averages O(n log n) and works in place but degrades to O(n^2) with consistently bad pivots.
Quicksort: an example
For [7, 2, 9, 4] with pivot 7: smaller items [2, 4] go left, larger [9] goes right, then each side is sorted.
Related terms
More Data structures algorithms terms
- Radix sort
- Randomized algorithm
- Recurrence relation
- Recursion
- Red-black tree
- Reservoir sampling
- Segment tree
- Selection sort
Where you learn it
Quicksort is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.