Big-O Complexity & Data Structures Printable Cheat Sheet
Time & Space Complexity for All Core Data Structures & Sorting Algorithms
Data Structure Operation Complexities 1-Page Cheatsheet
Array / Dynamic Array
Access: O(1) | Search: O(N) | Insert/Delete: O(N) | Append: O(1) amortizedWhen to use: Contiguous memory
Fast indexed reads. Expensive middle insertions.
Singly Linked List
Access: O(N) | Search: O(N) | Insert at Head: O(1) | Delete Node: O(1) with pointerWhen to use: Node pointers
Fast head prepend; slow random access.
Hash Table / HashMap
Search: O(1) avg, O(N) worst | Insert: O(1) avg | Delete: O(1) avgWhen to use: Hash buckets
Collision resolution via chaining or open addressing.
Binary Search Tree (Balanced)
Search: O(log N) | Insert: O(log N) | Delete: O(log N)When to use: AVL / Red-Black
Maintains sorted order. Unbalanced degrades to O(N).
Binary Heap (PriorityQueue)
Find Min/Max: O(1) | Insert: O(log N) | Extract: O(log N) | Heapify: O(N)When to use: Complete binary tree
Used for Top K, Dijkstra, scheduling.
Sorting Algorithm Complexities 1-Page Cheatsheet
QuickSort
Best: O(N log N) | Avg: O(N log N) | Worst: O(N²) | Space: O(log N)When to use: Divide & conquer pivot
In-place, not stable. Worst case occurs with bad pivot selection.
MergeSort
Best: O(N log N) | Avg: O(N log N) | Worst: O(N log N) | Space: O(N)When to use: Divide & merge halves
Stable sort. Guaranteed O(N log N) time regardless of input.
HeapSort
Best: O(N log N) | Avg: O(N log N) | Worst: O(N log N) | Space: O(1)When to use: Binary heap in-place
Guaranteed O(N log N) with zero auxiliary memory.