constant time

Work that stays the same no matter how large the input is, written O(1).

In more detail

Reading a list element by index, pushing onto a stack and looking up a key in a dict are all constant time on average. Constant does not mean instant; it means the cost does not depend on n. A dict lookup among ten items and among ten million items costs about the same.

Related terms

Taught in

References