AlgoViz

O(1) constant time

easy 13 min

O(1) means an operation takes a fixed amount of work no matter how large the input is.

O(1) operations side by side

Read it, run it, change a line and run it again.

Loading editor…

Array indexing, dict and set operations, stack push and pop, a variable swap and a linked list head insert. None of them loops over the data, so each costs the same at any size.