Data Structures & Algorithms
Follow the roadmap from top to bottom. Each topic covers the idea, a complexity table, Python code and the interview problems you should solve next.
Beginner
- 1
Time & Space Complexity
Big-O notation: how to measure how fast code grows as input grows.
- 2
Arrays & Two Pointers
Contiguous memory, index access, and the two-pointer / sliding window patterns.
- 3
Strings & Hashing
Hash maps and sets for O(1) lookups — the most used tool in interviews.
- 4
Linked Lists
Nodes connected by pointers — reversal, fast/slow pointers and merging.
- 5
Stacks & Queues
LIFO and FIFO structures, plus the monotonic stack pattern.
Intermediate
- 6
Recursion & Backtracking
Functions that call themselves, and exploring choices with undo.
- 7
Sorting & Binary Search
Merge sort, quick sort and binary search on answers.
- 8
Trees & Binary Search Trees
Hierarchical data: traversals, depth, and BST properties.
- 9
Heaps & Priority Queues
Always get the smallest (or largest) item fast — top-K problems.
- 10
Two Pointers & Sliding Window
Turn O(n²) subarray/substring scans into O(n) by moving two indices smartly.
Advanced
- 11
Graphs: BFS, DFS & Shortest Paths
Nodes and edges — traversal, connected components, topological sort, Dijkstra.
- 12
Dynamic Programming
Break problems into overlapping subproblems and reuse answers.
- 13
Greedy Algorithms
Take the best local choice at each step — when it provably works.
- 14
Monotonic Stack & Deque
Keep a stack/deque sorted to answer 'next greater' and 'window max' in O(n).
- 15
Backtracking
Explore every choice, undo it, try the next — with pruning to stay fast.
- 16
Shortest Paths: Dijkstra, Bellman-Ford, 0-1 BFS
Find cheapest routes in weighted graphs and know which algorithm fits.
Expert
- 17
Trie (Prefix Tree)
Store strings by shared prefixes for instant autocomplete and prefix search.
- 18
Disjoint Set Union (Union-Find)
Track connected groups with near-constant-time merge and lookup.
- 19
Segment Tree & Fenwick Tree
Answer range sum/min queries with point updates in O(log n).
- 20
Advanced Graphs: SCC, Bridges, Articulation Points
Find strongly connected components and critical edges using DFS low-links.
- 21
Advanced DP: Bitmask, Intervals, Digit DP
Model hard optimisation problems with clever DP states.
Can't find a DSA topic you need for exams or placements? Request it and we'll add it.