Time complexity

Also known as: Running time, Time cost

Time complexity describes how an algorithm’s running time grows with input size, usually in Big-O / $\Theta$ of elementary steps (comparisons, arithmetic, memory words), not wall-clock seconds.

State the case: best, average, or worst. Quicksort is $\Theta(n \log n)$ average and $\Theta(n^2)$ worst; hash table lookup is expected $O(1)$ and $O(n)$ worst with bad hashing.

Polynomial time is the theory cutoff for “tractable” decision procedures. In engineering, cache behavior and constants still decide which $O(n \log n)$ routine wins.

← Back to CS Glossary