Skip to content

DSA Roadmap

This is the order I'm learning DSA in, and why. Each topic builds on the previous — the sequence matters.


Start here — the interview method

Patterns get you to a solution; method gets you through the room.

Philosophy: learn patterns, not problems. Internalize a pattern and new problems become variations. Always plan your own approach before reading any solution.


Group 1 — The Recursion Family (built on Tree)

"We can learn about recursion: Base case; Recurrence Relation; How children respond to their parents; DFS, BFS."

Tree is the gateway. Once you understand how a tree node delegates work to its children and combines results on the way back up, the rest of this group follows naturally.

  1. Trees & Recursion — the foundation
  2. Backtracking — explore all paths, prune bad ones
  3. Dynamic Programming — memoize overlapping sub-problems
  4. Divide and Conquer — split, solve, merge
  5. Graphs — generalized trees with cycles
  6. Linked List — foundational node-chain structure; pointer manipulation practice for tree/graph work

Group 2 — Hashmap as a Supporting DS

"We can use this one as a supporting DS: Frequency; Memorize (memoize); Access key with O(1). Note: Anything can be a key."

Hashmap rarely stands alone — it amplifies every other technique.

  • Hashmap — the universal supporting structure
    1. Prefix Sum — range queries powered by a hashmap
    1. Strings — frequency maps, anagram detection, window tricks

Group 3 — Sliding Window → Two Pointers

  1. Sliding Window — variable-length window that grows/shrinks to satisfy a condition
  2. Two Pointers — "main algorithm to check the sub-array with given conditions; slow-fast pointers; opposite-ends pointers"
  3. Intervals — merge/insert/sweep; an array-scan technique that pairs naturally with two-pointer thinking

Group 4 — Heap & Stack

  1. Heap & Stack — combined with hashmap, extremely useful in system design; "top is the most important thing"
  • Greedy — the counterpart to DP: when the exchange argument holds, take the locally optimal choice; no memoization needed

  1. Binary Search — "define what to search, and the validation function is the most important thing"

Bonus (if you have time)


Further reading