Skip to main content

Big O—Popular Data Structures

Table below shows the average time complexities related to different operations for different data structures. Also, it includes corresponding (worst) space complexities.

Data StructureAccessSearchInsertionDeletionSpace Complexity
ArrayO(1)O(1)O(n)O(n)O(n)O(n)O(n)O(n)O(n)O(n)
Linked ListO(n)O(n)O(n)O(n)O(1)O(1)O(1)O(1)O(n)O(n)
StackO(n)O(n)O(n)O(n)O(1)O(1)O(1)O(1)O(n)O(n)
QueueO(n)O(n)O(n)O(n)O(1)O(1)O(1)O(1)O(n)O(n)
Hash Table-O(1)O(1)O(1)O(1)O(1)O(1)O(n)O(n)
Disjoint Set or Union-Find-Find: **O(α(n))O(\alpha({n}))Union: **O(α(n))O(\alpha({n}))-O(n)O(n)

***More will be added.

** O(α(n))O(\alpha({n})): Practically, O(1)O(1). Here, α\alpha is known as the inverse Ackermann function.