Skip to content

Resource · Guide or article

Quicksort

Quicksort steps (pick a pivot, partition, recurse) with its complexity figures, a sorting algorithm often discussed in interviews.

Reviewed

Open the original: Quicksort (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Read this in other languages: 简体中文, Português Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays Animated visualization of the quicksort algorithm. The horizontal lines are pivot values.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Reference

What it covers

  • Three numbered steps including the partition operation.
  • Complexity table: n log(n) best and average, n squared worst, not stable.
  • Note that in-place quicksort uses O(log(n)) stack space.

How to use it

PrepKit study advice, not a claim made by the source.

Implement in-place partitioning, run it on an already sorted array, and explain what causes the n squared case.

Scope and limitations

No pivot selection strategies or partition scheme comparison; references are Wikipedia and YouTube. Chinese and Portuguese versions are linked.

Access and format

English README, free on GitHub in trekhleb/javascript-algorithms (MIT).

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/algorithms/sorting/quick-sort/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email