Back to Developer Roadmap

Constant

src/data/roadmaps/datastructures-and-algorithms/content/constant@_bpV8MkVOY8ZatTXYaEE4.md

4.0549 B
Original Source

Constant

Constant time complexity is denoted as O(1). This means the running time of the algorithm remains constant, regardless of the size of the input data set. Whether you're working with an array of 10 elements or 1 million, if an operation takes the same amount of time regardless of the size of the array, it is said to have a constant time complexity. For example, accessing any element in an array by index is an O(1) operation, as the access operation takes the same amount of time regardless of the position of the element in the array.