Choose a Topic
Data Structure Modules
📦

Arrays & Strings

The most fundamental DS. Contiguous memory, index-based access, and the backbone of most problems.

IndexingSliding WindowTwo Pointers
🗂️

Hash Maps & Sets

O(1) lookup. The secret weapon for turning O(n²) solutions into O(n). Used in ~40% of all problems.

O(1) LookupFrequency CountDeduplication
🔗

Linked Lists

Nodes connected by pointers. Dynamic size, O(1) insert/delete but O(n) search. Singly & Doubly.

Nodes & PointersFast/Slow PtrReversal
📚

Stacks & Queues

LIFO and FIFO data structures. Used for parentheses matching, BFS, undo history, and monotonic patterns.

LIFO/FIFOMonotonic StackBFS
🌳

Trees & BST

Hierarchical structures. Binary Trees, BSTs, traversals (pre/in/post/level), LCA, diameter, and more.

DFS/BFSBSTRecursionLCA
🕸️

Graphs

Nodes and edges. Directed/undirected, weighted/unweighted. BFS, DFS, adjacency list/matrix.

BFSDFSAdjacency ListUnion Find
⛰️

Heaps (Priority Queue)

Always gives you the min or max in O(log n). Essential for Top-K problems, Dijkstra, and scheduling.

Min-HeapMax-HeapTop KHeapify
Quick Reference
Operations at a Glance
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.

Suggested Order
Study Sequence
1

Arrays & Strings

Foundation of everything. All other DS build on array concepts.

Week 2
2

Hash Maps & Sets

Immediately boosts your ability to optimize array solutions.

Week 2
3

Linked Lists

Introduces pointer thinking — critical for trees and graphs.

Week 3
4

Stacks & Queues

Abstract DS built on arrays/linked lists. Prepares you for BFS/DFS.

Week 3
5

Trees & BST

The most common interview DS. Requires recursion + pointer skills.

Week 4
6

Graphs

Generalization of trees. BFS/DFS mastery before tackling graphs.

Week 5
7

Heaps

Specialized tree. Key for Top-K and priority-based problems.

Week 5
What You'll Build Intuition For
7 structures — one mental model each
Arrays
contiguous memory
h(k)
Hashing
O(1) lookup
Linked Lists
pointer chains
← TOPFRONT
Stack/Queue
LIFO / FIFO
Trees
recursive structure
Graphs
BFS / DFS / Union-Find
147
Heaps
O(log n) priority
← Phase 1: Foundation Phase 3: Algorithms →