Complexity classes0/59 done

Complexity classes

Big ONameTypical sourcen = 1M feels like
O(1)constanthash lookup, array indexinstant
O(log n)logarithmicbinary search, heap op, B+tree~20 steps
O(n)linearone passmilliseconds
O(n log n)linearithmicgood sorting~20M steps, fine
O(n²)quadraticnested loops10¹² steps, too slow
O(2ⁿ), O(n!)exponentialsubsets, permutationsonly for n under ~20

Rough guide from input size: n up to 10⁴ allows O(n²). n up to 10⁶ needs O(n log n) or better.

Words interviewers use

AmortizedAverage cost per operation over a long run. A dynamic array push is O(1) amortized even though a resize is O(n).
Average vs worstHash map O(1) average, O(n) worst. Quick sort n log n average, n² worst. Say both.
SpaceExtra memory you allocate, plus recursion depth.
Stable sortEqual items keep their original order.
In placeO(1) extra memory, apart from recursion.