Time Complexity
Time Complexity
com/
Data Structures
Sorting
Graphs
Heaps
Chart
Comments
I receive
$4.69
on Gratipay.
4,165 2.5k
Tweet
Legend
Excellent Good Fair Bad Horrible
1 of 6 05/11/2015 11:53 AM
Big-O Algorithm Complexity Cheat Sheet http://bigocheatsheet.com/
Stack O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
Singly-Linked List O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
Doubly-Linked List O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
Skip List O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(n log(n))
Binary Search Tree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(n)
Cartesian Tree - O(log(n)) O(log(n)) O(log(n)) - O(n) O(n) O(n) O(n)
B-Tree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)
Red-Black Tree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)
Graph Operations
Node / Edge Management Storage Add Vertex Add Edge Remove Vertex Remove Edge Query
Adjacency list O(|V|+|E|) O(1) O(1) O(|V| + |E|) O(|E|) O(|V|)
Incidence matrix O(|V| ⋅ |E|) O(|V| ⋅ |E|) O(|V| ⋅ |E|) O(|V| ⋅ |E|) O(|V| ⋅ |E|) O(|E|)
Heap Operations
Type Time Complexity
Heapify Find Max Extract Max Increase Key Insert Delete Merge
Linked List (sorted) - O(1) O(1) O(n) O(n) O(1) O(m+n)
Linked List (unsorted) - O(n) O(n) O(1) O(1) O(1) O(1)
2 of 6 05/11/2015 11:53 AM
Big-O Algorithm Complexity Cheat Sheet http://bigocheatsheet.com/
Recommended Reading
Cracking the Coding Interview: 150 Programming Questions and Solutions
Introduction to Algorithms, 3rd Edition
Data Structures and Algorithms in Java (2nd Edition)
High Performance JavaScript (Build Faster Web Application Interfaces)
Contributors
Edit these tables!
1. Eric Rowell
2. Quentin Pleple
3. Michael Abed
4. Nick Dizazzo
5. Adam Forsyth
6. David Dorfman
7. Jay Engineer
8. Jennifer Hamon
9. Josh Davis
10. Nodir Turakulov
11. Bart Massey
12. Vinnie Magro
13. Miguel Amigot
14. Drew Bailey
15. Aneel Nazareth
16. Rahul Chowdhury
17. Robert Burke
18. steven41292
19. Brandon Amos
20. Mike Davis
21. Casper Van Gheluwe
22. Joel Friedly
23. Oleg
24. Renfred Harper
25. Piper Chester
26. Eric Lefevre-Ardant
27. Jonathan McElroy
28. Si Pham
29. mcverry
30. Max Hoffmann
3 of 6 05/11/2015 11:53 AM
Big-O Algorithm Complexity Cheat Sheet http://bigocheatsheet.com/
4 of 6 05/11/2015 11:53 AM
Big-O Algorithm Complexity Cheat Sheet http://bigocheatsheet.com/
#1) http://aduni.org/courses/algor...
#2) http://ocw.mit.edu/courses/ele...
#3) https://www.udacity.com/course...
probably as good or maybe better # 2, but I have not had a chance to look
at it.
http://ocw.mit.edu/courses/ele...
Sincerely,
Arjan
p.s.
https://www.coursera.org/cours...
This course has just begun on coursera (dated 1 July 2013), and looks
very good.
11 • Reply • Share ›
5 of 6 05/11/2015 11:53 AM
Big-O Algorithm Complexity Cheat Sheet http://bigocheatsheet.com/
6 of 6 05/11/2015 11:53 AM