| Notation | Nickname | What it means | Example |
|---|---|---|---|
| O(1) | The Vending Machine | Work stays the same as the input grows | Array index; expected Map/Set lookup |
| O(log n) | The Halving | Cuts the remaining work in half each step | Binary search |
| O(n) | The Roll Call | One full pass through the input | Loop, find, filter, linear search |
| O(n x m) | The Two Crowds | Each item in one list checks the other list | .find() or .includes() inside a loop |
| O(n log n) | The Sorting Tax | Efficient general comparison sorting | Merge sort; typically Array.sort() |
| O(n²) | The Handshake Problem | Every item meets every other item | Same-size nested loops; bubble sort |
| O(n³) | The Triple Loop | Three full-size dimensions multiply | Three same-range nested loops |
| O(2ⁿ) | The Doubling Monster | Each extra choice can double the cases | Naive Fibonacci; all subsets |
| O(n!) | The Seating Chart Nightmare | Tries every possible ordering | Generating all permutations |
These are typical costs for ordinary arrays, Maps, and Sets; exact engine behavior can vary. sort() changes its array.
Rule of pocket: Some of the biggest speed gains come from avoiding work the result never needs.