The DSA Dependency Graph: A Logical Roadmap from Arrays to DP
Source: Dev.to

The Problem
We often treat Data Structures and Algorithms (DSA) like a grocery list—pick “Heaps” today and “Graphs” tomorrow. But computer‑science topics have dependencies. You cannot understand Heaps without first understanding Arrays (how they are stored) and Trees (how they are visualized).
I created a 7‑Phase Roadmap to build a mental model step‑by‑step. This order ensures that every new topic uses tools you mastered in the previous phase.
Phase 1: Basic Linear Structures & Their Patterns
Goal: Master sequential data and index manipulation before touching complex nodes.
- Time & Space Complexity (Big‑O): The measuring stick for all code.
- Arrays: Memory models (static vs. dynamic).
- Searching & Sorting Algorithms: Essential prerequisite for Two Pointers.
- Recursion (Pattern): Basics – base case vs. recursive case.
- Two Pointers (Pattern): Most common array optimisation.
- Binary Search (Algorithm):
O(log N)logic. - Sliding Window (Pattern): Subarrays and substrings.
- Prefix Sum (Pattern): 1D and 2D range queries.
- Intervals (Pattern): Merging and inserting ranges.
- Matrix Traversal (Pattern): Basics of iterating 2D grids.
Phase 2: The Power of Lookup (Hashing)
Goal: Trade space for speed.
- Hash Table / Hash Map: The
O(1)lookup king. - Strings: Immutability and manipulation techniques.
Phase 3: Pointers & Recursion
Goal: Move from indexes to references.
- Linked List: Single and doubly linked.
- Recursion (Advanced): Multiple recursive calls (pre‑pares for memoisation).
- Stack & Queue: LIFO and FIFO mechanics.
- Monotonic Stack (Pattern): Finding the “next greater element”.
- Fast & Slow Pointers (Pattern): Cycle detection.
Phase 4: Non‑Linear Structures (Hierarchical)
Goal: Understand parent‑child relationships.
- Trees: Height, depth, diameter properties.
- Binary Trees: Standard interview structure.
- Tree Traversals: Preorder, Inorder, Postorder, Level‑order.
- Binary Search Tree (BST): Sorted hierarchical data.
- Heaps / Priority Queue: Organising by priority.
- Top K Elements (Pattern): Using heaps efficiently.
- Divide and Conquer (Pattern): Merge‑sort logic applied to trees.
Phase 5: Advanced Search & Backtracking
Goal: Explore all possibilities.
- Backtracking (Pattern): Solving puzzles (Sudoku, N‑Queens).
- Tries: Prefix trees for autocomplete.
Phase 6: Connectivity (Graphs)
Goal: Model many‑to‑many relationships.
- Graphs: Adjacency matrix vs. adjacency list.
- Matrix Traversal (Advanced): Treating grids as graphs.
- Graph Traversals: BFS (shortest path in unweighted graphs) & DFS.
- Union‑Find: Disjoint Set Union (DSU).
- Shortest Path: Dijkstra’s algorithm.
Phase 7: Optimisation (The Hardest Part)
Goal: Solve overlapping sub‑problems.
- Bit Manipulation: Binary logic.
- Dynamic Programming (DP):
- The pipeline: Recursion → Memoisation → Tabulation → Space Optimisation.
Why This Order?
- Recursion Split: Basic recursion is needed for sorting; advanced recursion is required for trees and DP.
- Matrix Split: You must know how to loop through a matrix (Phase 1) before running BFS on it (Phase 6).
- Patterns First: “Two Pointers” follows Arrays because that’s how arrays are used in real‑world problems.
Save this roadmap and stop getting lost in the noise! 🚀