DSADSA Roadmap

DSA Roadmap

Data Structures and Algorithms (DSA) is one of the most learnable skills in software engineering — but only if you learn topics in the right order. Jump straight to dynamic programming before understanding arrays and you will struggle. Master the foundations and advanced topics become intuitive.

This roadmap organizes topics into three phases — Beginner, Intermediate, and Advanced — and gives you an honest timeline based on consistent daily practice (1–2 hours per day).

Phase 1: Foundations (4–6 weeks)

These topics appear in virtually every coding interview and form the building blocks for everything else. Do not rush past this phase — weak foundations cause confusion later.

  1. Complexity Analysis — Big-O notation, time vs space, analyzing loops and recursion

  2. Arrays — indexing, iteration, two-pointer technique, sliding window

  3. Strings — character manipulation, substring problems, string hashing

  4. Hash Maps & Hash Sets — O(1) lookup, frequency counting, grouping problems

  5. Stacks — LIFO, monotonic stack, balanced parentheses, next greater element

  6. Queues & Deques — FIFO, BFS traversal, sliding window maximum

  7. Linked Lists — singly/doubly linked, fast-slow pointers, reversal

  8. Recursion — base cases, recursive thinking, backtracking introduction

Note
Aim for 3–5 LeetCode Easy problems per topic before moving on. You should be able to write a clean solution in under 20 minutes for Easy problems before advancing to Medium.
Phase 2: Core Data Structures & Algorithms (6–8 weeks)

With Phase 1 solid, these topics unlock the majority of Medium-level interview problems. Most FAANG phone screens test material from this phase.

  1. Binary Search — sorted arrays, search on answer, rotated arrays, variants (lower/upper bound)

  2. Sorting — merge sort, quicksort, heap sort, counting/radix sort, when to use each

  3. Trees (Binary Trees) — DFS, BFS, traversals (preorder/inorder/postorder), level-order

  4. Binary Search Trees — insert/delete/search, BST invariant, in-order gives sorted output

  5. Heaps & Priority Queues — min-heap, max-heap, top-K problems, heap sort

  6. Graphs — adjacency list/matrix, DFS, BFS, connected components, cycle detection

  7. Two Pointers & Sliding Window — O(n) instead of O(n²) for subarray problems

  8. Prefix Sums — O(1) range queries after O(n) preprocessing

Phase 3: Advanced Topics (8–12 weeks)

These topics separate good candidates from great ones. They appear in FAANG onsite rounds and competitive programming contests. Each topic requires Phase 1 and 2 as prerequisites.

  1. Dynamic Programming — memoization, tabulation, common patterns (knapsack, LCS, LIS)

  2. Backtracking — generate all solutions, pruning, combinations/permutations/subsets

  3. Greedy Algorithms — interval scheduling, activity selection, Huffman coding

  4. Tries — prefix trees, autocomplete, word search

  5. Union-Find (Disjoint Set) — cycle detection, connected components, Kruskal MST

  6. Segment Trees & Fenwick Trees — range queries with updates

  7. Shortest Path Algorithms — Dijkstra, Bellman-Ford, Floyd-Warshall

  8. Minimum Spanning Tree — Kruskal, Prim

  9. Topological Sort — DAG ordering, course schedule, build systems

  10. Advanced DP — bitmask DP, DP on trees, digit DP

Topic Dependency Map

Topic

Prerequisites

Unlocks

Arrays

None

Two pointers, sliding window, most other topics

Hash Maps

Arrays

Fast grouping, frequency problems, graph adjacency lists

Stacks

Arrays

Monotonic stack, expression parsing, DFS iterative

Binary Search

Arrays (sorted)

Search on answer, rotated array, binary search variants

Recursion

Arrays, functions

Trees, graphs, backtracking, divide and conquer

Linked Lists

Pointers/references

LRU cache, graph adjacency lists

Trees

Recursion, queues

BST, heaps, tries, segment trees, DP on trees

Graphs

Trees, hash maps

Shortest path, topological sort, MST, SCC

Dynamic Programming

Recursion, arrays

Optimization problems, advanced graph DP

Heaps

Trees

Priority queues, Dijkstra, top-K problems, heap sort

Realistic Timeline

Phase

Duration

LeetCode Target

Goal

Phase 1: Foundations

4–6 weeks

~50 Easy

Solve any Easy in < 20 min

Phase 2: Core DSA

6–8 weeks

~80 Medium

Solve most Mediums in 30 min

Phase 3: Advanced

8–12 weeks

~50 Medium + 20 Hard

Recognize patterns instantly

Interview prep

4 weeks

Review + mock interviews

Communicate solutions clearly

Warning
These are averages for someone studying 1–2 hours daily. Working full-time or studying less frequently will extend the timeline — and that is fine. Consistency matters more than speed. Cramming 10 hours one weekend is far less effective than 1 hour every day.
What FAANG/Top Tech Companies Expect

Companies like Google, Meta, Amazon, Apple, Netflix, and Microsoft evaluate candidates on:

  • Correctness — does your solution handle all edge cases (empty input, single element, duplicates)?

  • Efficiency — can you state and achieve optimal time and space complexity?

  • Communication — do you think out loud, explain your approach before coding?

  • Clean code — readable variable names, proper structure, no spaghetti logic

  • Verification — do you trace through examples and test your own code?

The most common interview patterns by frequency at top companies:

Pattern

Frequency

Example Problems

Arrays / Two Pointers

Very High

Two Sum, Container With Most Water, 3Sum

Sliding Window

Very High

Longest Substring Without Repeating, Max Sliding Window

Binary Search

High

Search Rotated Array, Find Peak Element, Koko Eating Bananas

Tree DFS/BFS

High

Max Depth, Level Order, Path Sum, LCA

Dynamic Programming

High

Climbing Stairs, Coin Change, Longest Common Subsequence

Graph BFS/DFS

High

Number of Islands, Clone Graph, Course Schedule

Hash Map

High

Group Anagrams, Top K Frequent, Subarray Sum Equals K

Stack

Medium

Valid Parentheses, Daily Temperatures, Largest Rectangle in Histogram

Heap / Priority Queue

Medium

Merge K Sorted Lists, K Closest Points, Task Scheduler

Backtracking

Medium

Subsets, Permutations, N-Queens, Word Search

Study Strategy
  1. Learn the concept — understand why and how, not just what the code looks like

  2. Implement from scratch — write the data structure or algorithm without looking it up

  3. Solve 5–10 problems on that topic — start Easy, progress to Medium

  4. Review wrong answers — understand WHY your solution failed before reading solutions

  5. Spaced repetition — revisit topics after 1 week, then 1 month, then before interviews

Tip
The single most common mistake is jumping to code before thinking. In interviews, spend the first 5 minutes asking clarifying questions, working through examples by hand, and stating your approach. A mediocre algorithm explained clearly beats a perfect algorithm written in silence.
Problem-Solving Framework

JS
// The 6-step approach for any coding problem:

// 1. UNDERSTAND: Restate the problem. Ask about constraints.
//    - Input/output types? Edge cases (empty, null, duplicates)?
//    - What are the size constraints on n?

// 2. EXAMPLES: Work through 2-3 examples by hand (including edge cases).
//    - Build intuition before touching code.

// 3. BRUTE FORCE: Describe the naive O(n²) or O(2^n) solution.
//    - Shows you understand the problem even if you cannot optimize yet.

// 4. OPTIMIZE: Identify the bottleneck. Apply known patterns.
//    - Can I sort first? Use a hash map for O(1) lookup?
//    - Two pointers instead of nested loops?
//    - Binary search instead of linear scan?

// 5. CODE: Write clean, readable code.
//    - Good variable names. Short functions. Avoid clever tricks.

// 6. VERIFY: Trace through examples. Test edge cases.
//    - Empty input. Single element. All duplicates. Already sorted.
Note
You do not need to solve every LeetCode problem. Quality beats quantity. Deeply understanding 200 problems (why each solution works, what pattern it uses, what edge cases matter) is worth more than rushing through 1,000 problems.