Sorting Algorithms Cheat Sheet — 1-page PDF
Selection, insertion, merge, quicksort, heapsort, counting/radix, stability, recurrences, lower bounds. The whole course on one dense, printable page for your midterm or final, with every formula typeset and worked examples where they help.
The first part is free below. See pricing →
- 1 pageUS Letter
- 11 sections10 topics
- Free previewfull sheet with Unlimited
Cheat sheet locked
On the sheet
What’s on it
The topics a typical Sorting Algorithms exam tests, all on the one page.
- Selection sort
- Insertion sort
- Merge sort
- Quicksort and pivot choice
- Heapsort
- Counting and radix sort
- Stability
- Time and space complexity table
- Lower bound for comparison sorts
- Recurrences
Free preview
The free part, as text
The free part of the sheet, section by section. Unlock the full sheet to read the rest, edit any block, and print it or save it as a PDF.
01Core terms
- Array of keys to sort; output usually nondecreasing order.
- Stable sort
- Preserves relative order of equal keys.
- In-place
- Uses extra space beyond input array (ignoring recursion stack unless stated).
- Comparison sort
- Sorting algorithm whose decisions depend only on key comparisons.
- Adaptive
- Faster on nearly sorted input; runtime depends on presortedness.
- Cost measures
- Time usually counted by comparisons / moves; space by extra memory.
Common properties
| Alg | Stable? | In-place? |
|---|---|---|
| Selection | No | Yes |
| Insertion | Yes | Yes |
| Merge | Yes | No |
| Quicksort | No | Yes |
| Heapsort | No | Yes |
| Counting | Yes, with stable placement | No |
| Radix | Yes, if stable pass | No |
02Insertion sort
- Why stable
- Only shifts items with ; equal keys are not moved past each other.
Watch out:Common trap: inner loop comparisons can be per insertion; total .
03Merge sort
Recurrence
Split into two halves, merge in linear time.
Solution
By Master Theorem / recursion tree.
Merge
Merge two sorted lists of sizes :
Compare fronts, append smaller.
- Stable?
- Yes, if equal keys are taken from left subarray first.
Space
Standard array merge needs auxiliary array of size .
Watch out:Not in-place in the standard implementation; recursion depth .
04Heapsort
Array indices
1-indexed heap array.
Watch out:Not stable; equal keys may move during sift-down.
05Counting sort
- Use case
- Keys are integers in a small range .
Time
Counts occurrences, prefix sums, then place items.
Space
Auxiliary count array plus output array.
Prefix sums
After counting, gives number of keys .
- Stable counting sort
- Place items scanning input right-to-left using prefix-sum positions.
Watch out:Only practical when or at least not much larger than .
06Recurrences
Useful solves
Common in merge/quicksort worst-case-style recurrences.
Watch out:Master Theorem does not apply directly to all recurrences; check form first.
07Complexity & bounds
Sorting complexity summary
| Alg | Best | Avg | Worst | Extra space |
|---|---|---|---|---|
| Selection | ||||
| Insertion | ||||
| Merge | ||||
| Quick | avg, worst stack | |||
| Heap | ||||
| Counting | ||||
| Radix |
Cheat sheet locked
Also on the full Sorting Algorithms sheet
8 more sections, with every definition, formula and worked example. Unlimited unlocks every full sheet in the library to edit, print or save as a PDF, and makes unlimited sheets from your own notes.
Selection sort
- Selection
- Time
- Swaps
Insertion sort
- Insertion
- Best
- Worst
- Space
Quicksort
- Partition
- Recurrence
- Average
- Worst
- Randomized quicksort
- Pivot choice
Heapsort
- Binary heap
- Build-heap
- Heapsort
- Space
Radix sort
- Radix sort
- LSD radix
- LSD
- MSD
Recurrences
- Master
- Case 1
- Case 2
- Case 3
Complexity & bounds
- Comparison lower bound
- Decision tree bound
- Lower-bound proof
- Stirling
Exam traps
FAQ
Questions
About the Sorting Algorithms sheet and making your own.
- What does this Sorting Algorithms cheat sheet cover?
- It has 11 sections: Core terms, Selection sort, Insertion sort, Merge sort, Quicksort, Heapsort, Counting sort, Radix sort, Recurrences, Complexity & bounds and Exam traps. Together they cover the topics a typical Sorting Algorithms exam tests, including selection sort, insertion sort, merge sort and quicksort and pivot choice.
- Is the sorting algorithms cheat sheet free?
- The first part is free to read on this page, with no account needed. The full sheet opens in the app with Unlimited ($4.99 a month or $19 for a semester), where you can edit it, print it or save it as a PDF. It is one US Letter page and prints cleanly in black and white or colour.
- Can I bring this Sorting Algorithms cheat sheet to my exam?
- Only if your course allows a note sheet, so check the syllabus. This one is a single US Letter page. If your exam allows a different size, such as a 3x5 or 4x6 index card or one page front and back, Cheat Sheet AI makes one at exactly that size from your own lecture notes.
- How accurate is it?
- The sheet was written by our engine from a standard course outline, then a second model fact-checked every formula and statement against it; it corrected 3 statements before publishing. Notation and emphasis vary between courses, so check it against your own lecture notes.
- Can I make a Sorting Algorithms sheet from my own notes?
- Yes. Upload your lecture slides, notes or study guide and Cheat Sheet AI writes a sheet in your course's notation, sized to exactly the space your exam allows. Your first sheets are free.
Keep going
More sheets
All 40 sheets are in the sheet library.
Your course, your notes, one page.
Upload your own Sorting Algorithms slides or notes and get a study sheet in your course’s notation. Your first sheet needs no account, and a free account adds one more. See pricing