Computer ScienceGeneralQuality 75 · Exceptional

Understanding Quicksort's Partition Step

PR
Tate LindgrenTeacher Tier
@author · 2026-08-28 · v1
7 min read
Quicksort picks a pivot, partitions the array so smaller elements go left and larger go right, then recursively sorts both halves. Average time is
O(nlog⁡n)O(n \log n)
, worst case
O(n2)O(n^2)
when the pivot is always the smallest or largest. Choosing a random pivot avoids the worst case in practice.
0 teacher endorsements

Discussion

Comments support LaTeX — write ∫01x2 dx\int_0^1 x^2\,dx inline with $...$.

Sign in to join the discussion.

No comments yet

Be the first to share your thoughts.