Complexity specification
Complexity specification
Posted Dec 5, 2025 9:55 UTC (Fri) by intelfx (subscriber, #130118)In reply to: Complexity specification by taladar
Parent article: A "frozen" dictionary for Python
> O(1) means constant time, O(n) means the time scales with the number of inputs.
Obviously, yes. What the GP is saying is that functions that are O(1) are also, strictly speaking, O(n), since the big-O notation only defines, informally, an "upper bound" on the algorithmic complexity.
(The answer here is that engineers tend to casually use the big-O notation where they really mean Knuth's Θ notation instead.)
