O1 Constant Time

1 min read
Foundational1 min read
Rapid overview

O1 Constant Time

TL;DR

Operations that execute in a fixed amount of time regardless of input size.

How it works

const first = items[0];
const hasUser = userMap.has(userId);

Notes

  • Array index access is O(1).
  • Map/Set insert and lookup are average O(1).

See also