Arrays & Strings
The most fundamental DS. Contiguous memory, index-based access, and the backbone of most problems.
Hash Maps & Sets
O(1) lookup. The secret weapon for turning O(n²) solutions into O(n). Used in ~40% of all problems.
Linked Lists
Nodes connected by pointers. Dynamic size, O(1) insert/delete but O(n) search. Singly & Doubly.
Stacks & Queues
LIFO and FIFO data structures. Used for parentheses matching, BFS, undo history, and monotonic patterns.
Trees & BST
Hierarchical structures. Binary Trees, BSTs, traversals (pre/in/post/level), LCA, diameter, and more.
Graphs
Nodes and edges. Directed/undirected, weighted/unweighted. BFS, DFS, adjacency list/matrix.
Heaps (Priority Queue)
Always gives you the min or max in O(log n). Essential for Top-K problems, Dijkstra, and scheduling.
DS Complexity Cheat Sheet — All Data Structures ›
| Data Structure | Access | Search | Insert | Delete | Space |
|---|---|---|---|---|---|
| Array | O(1) | O(n) | O(n) | O(n) | O(n) |
| Hash Map | O(1) | O(1) | O(1) | O(1) | O(n) |
| Linked List | O(n) | O(n) | O(1) | O(1) | O(n) |
| Stack | O(n) | O(n) | O(1) | O(1) | O(n) |
| Queue | O(n) | O(n) | O(1) | O(1) | O(n) |
| Binary Tree | O(n) | O(n) | O(n) | O(n) | O(n) |
| BST (balanced) | O(log n) | O(log n) | O(log n) | O(log n) | O(n) |
| Heap | N/A | O(n) | O(log n) | O(log n) | O(n) |
| Graph (Adj List) | O(V+E) | O(V+E) | O(1) | O(E) | O(V+E) |
🧠 When to Use Which Data Structure? ›
Array: When you need index access, cache efficiency, or fixed-size
storage.
Hash Map: When you need O(1) lookup by key — frequency counting,
deduplication, memoization.
Linked List: When you need frequent O(1) inserts/deletes at head/tail
without random access.
Stack: LIFO — parentheses matching, DFS, undo/redo, function call
simulation.
Queue: FIFO — BFS, task scheduling, sliding window.
Tree: Hierarchical data, DFS/BFS problems, BST for sorted dynamic
data.
Graph: Network relationships, shortest path, connected components,
cycles.
Heap: Need the min/max repeatedly — Top-K, Dijkstra, merge K sorted
lists.
Arrays & Strings
Foundation of everything. All other DS build on array concepts.
Hash Maps & Sets
Immediately boosts your ability to optimize array solutions.
Linked Lists
Introduces pointer thinking — critical for trees and graphs.
Stacks & Queues
Abstract DS built on arrays/linked lists. Prepares you for BFS/DFS.
Trees & BST
The most common interview DS. Requires recursion + pointer skills.
Graphs
Generalization of trees. BFS/DFS mastery before tackling graphs.
Heaps
Specialized tree. Key for Top-K and priority-based problems.