Big-O Cheat Sheet

Time and space complexity reference for algorithms.

Big-O Complexity Chart

Data Structures

StructureAccessSearchInsertDelete
ArrayO(1)O(n)O(n)O(n)
StackO(n)O(n)O(1)O(1)
QueueO(n)O(n)O(1)O(1)
Linked ListO(n)O(n)O(1)O(1)
Hash TableO(1)O(1)O(1)O(1)
BSTO(log n)O(log n)O(log n)O(log n)

Sorting Algorithms

AlgorithmBestAverageWorstSpace
Quick SortO(n log n)O(n log n)O(n^2)O(log n)
Merge SortO(n log n)O(n log n)O(n log n)O(n)
Bubble SortO(n)O(n^2)O(n^2)O(1)
Insertion SortO(n)O(n^2)O(n^2)O(1)
Heap SortO(n log n)O(n log n)O(n log n)O(1)

How to use Big-O Cheat Sheet

This free online big-o cheat sheet allows you to time and space complexity reference for algorithms.It is fast, secure, and runs entirely in your browser.

More in Computer Science