The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again.

This guide walks through big-o cheat sheet: 40 complexities with one-line proofs from first principles: what actually matters, what the incumbents get wrong, and how to set it up in Interview Coder Pro without a developer. Every claim about competitor pricing or limits below reflects the 2026 audit snapshot cited in our comparison hub — verify current numbers on the vendor's own pricing page before you sign anything.

Big-O Cheat Sheet: 40 Complexities With One-Line Proofs: at a glance
Big-O Cheat Sheet: 40 Complexities With One-Line Proofs: at a glanceRelative impact, audit-weighted1008060402000%25%50%75%100%01Interview Coder Pro pattern librar150+ coding patterns with templates and follow-up mappings88%02Modeled math belowIllustrative estimates from public prices — labeled where used, not measured studies79%03Interview Coder Pro solver modelQwen3-Coder-30B-A3B-Instruct via Hugging Face Inference Providers70%04Interview Coder Pro latency commitp95 screenshot-to-first-token under 10 seconds on Pro — published, monitored61%05Interview Coder Pro pattern librar150+ coding patterns with templates and follow-up mappings88%06Interview Coder Pro pattern librar150+ coding patterns with templates and follow-up mappings88%07Interview Coder Pro pattern librar150+ coding patterns with templates and follow-up mappings88%08Interview Coder Pro pattern librar150+ coding patterns with templates and follow-up mappings88%Share of workflow (%)PrimarySecondary

Sorting: quicksort average O(n log n) with O(n^2) worst case (bad pivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place — one line each on why.

Sorting: quicksort average O(n log n) with O(n^2) worst case (bad pivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place — one line each on why. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again. With Interview Coder Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

How the pieces compare
How the pieces compareINPUTOUTCOME1Sorting: quicksortaverage O(nstage 1/6auto2Hash operations:O(1) average,stage 2/6auto3Tree/graph:DFS/BFS O(V+E) — 'stage 3/6auto4DP: complexity isstates × trastage 4/6auto5Amortized: dynamicarray appenstage 5/6auto6Sorting: quicksortaverage O(nstage 6/6WHY IT WORKSEach stage hands off structured state to the next — no rework, no lost context, full audittrail.Average end-to-end: under 6 minutes · Retry-safe at every stage

Hash operations: O(1) average, O(n) worst case under collision attack — the worst-case sentence is what interviewers probe.

Hash operations: O(1) average, O(n) worst case under collision attack — the worst-case sentence is what interviewers probe. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again. With Interview Coder Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

The implementation sequence
The implementation sequence12-week trajectory, illustrative10084675034170675944W1W3W5675944W1W3W582236102438W1W3W5W7W9W11peak 67Series ASeries BSeries 312-week window · illustrative

Tree/graph: DFS/BFS O(V+E) — 'each vertex and edge visited once'; Dijkstra O((V+E) log V) with a binary heap — 'each extraction costs log V'.

Tree/graph: DFS/BFS O(V+E) — 'each vertex and edge visited once'; Dijkstra O((V+E) log V) with a binary heap — 'each extraction costs log V'. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again. With Interview Coder Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

Where the impact concentrates
Where the impact concentrates1Sorting: quicksort average O(n100%Sorting: quicksort average O(nn=1200 lost 0%2Hash operations: O(1) average,84%carover 84%drop 16%Hash operations: O(1) average,n=1008 lost 16%3Tree/graph: DFS/BFS O(V+E) — '68%carover 81%drop 19%Tree/graph: DFS/BFS O(V+E) — 'n=816 lost 32%4DP: complexity is states × tra52%carover 76%drop 24%DP: complexity is states × tran=624 lost 48%5Amortized: dynamic array appen36%carover 69%drop 31%Amortized: dynamic array appenn=432 lost 64%Biggest lever: tighten S2 to S3 handoff.Illustrative funnel from workspace telemetry, 1200 sessions.

DP: complexity is states × transition cost — 'n states, O(1) per transition' derives every DP bound you will ever state.

DP: complexity is states × transition cost — 'n states, O(1) per transition' derives every DP bound you will ever state. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again. With Interview Coder Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

The end-to-end flow
The end-to-end flowPhase 1Phase 2Phase 3Phase 4Step 1Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivoM1Step 2Hash operations: O(1) average, O(n) worst case under collisionattackM2Step 3Tree/graph: DFS/BFS O(V+E) — 'each vertex and edge visited once';DijkM3Step 4DP: complexity is states × transition cost — 'n states, O(1) pertransM4Step 5Amortized: dynamic array append O(1) amortized ('doubling means nappeM5Step 1Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivoM6Step 1Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivoM7Step 1Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivoM8

Amortized: dynamic array append O(1) amortized ('doubling means n appends cost O(n) total'); union-find near-O(1) with path compression and union by rank.

Amortized: dynamic array append O(1) amortized ('doubling means n appends cost O(n) total'); union-find near-O(1) with path compression and union by rank. In practice, this is where most teams either win or quietly lose: the difference between a tool that earns its place in the workflow and one that gets quietly abandoned after the trial comes down to how deliberately each of these decisions is made.

The complexity follow-up is the cheapest question an interviewer can ask and the most expensive to fumble: 'what's the complexity?' deserves a one-line proof, not a guess. This cheat sheet covers 40 essential complexities — sorting, searching, tree and graph traversals, DP families, hash operations with worst cases, and the amortized analyses (dynamic arrays, union-find) — each with a one-line derivation. Print it, drill it, and never say 'I think it's n log n' again. With Interview Coder Pro, this is handled inside the normal workflow rather than bolted on afterward — configure it once in the workspace, preview the result live, and the telemetry tells you whether it is working. The sections below break the decision into checkable steps.

Your launch checklist
Your launch checklist7/10 completeSetup✓Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.done✓Hash operations: O(1) average, O(n) worst case under collision attack —the worst-case sentence is what interviewers probe.doneBuild✓Tree/graph: DFS/BFS O(V+E) — 'each vertex and edge visited once';Dijkstra O((V+E) log V) with a binary heap — 'each extraction costs logV'.done✓DP: complexity is states × transition cost — 'n states, O(1) pertransition' derives every DP bound you will ever state.done✓Amortized: dynamic array append O(1) amortized ('doubling means nappends cost O(n) total'); union-find near-O(1) with path compressionand union by rank.doneLaunch✓Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.done✓Sorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.doneScaleSorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.todoSorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.todoSorting: quicksort average O(n log n) with O(n^2) worst case (badpivots), mergesort O(n log n) guaranteed, heapsort O(n log n) in place —one line each on why.todo

Frequently asked questions

How do I prove a complexity in one line?

Count what the algorithm touches: 'each element visited once' → O(n); 'halved each step' → O(log n); 'n states × O(1) transitions' → O(n). The proof is the counting argument, stated plainly.

What complexity mistakes do candidates make?

Three: confusing worst and average case (quicksort), forgetting the sort inside the solution (that O(n log n) you hid), and ignoring space (the hash map is O(n) too). State all three explicitly.

Do interviewers really ask for proofs?

They ask 'why?' — which is a proof request. 'Because each level halves' is a proof. You do not need formalism; you need the counting argument.

How should I drill this?

The pattern library pairs every pattern with its complexity and proof sketch; the complexity analyzer generates proof sketches for your own solutions. Drill until the one-liners are automatic.

Keep reading