Data Structures & Algorithms Roadmap
Topic-by-topic learning path

DSA is not about memorizing code or syntax — it's about understanding why it works, how it solves a problem, and when to use a particular approach. DSA is the key to unlocking any tech role: it's knocking on the door, while ML/DS/AI is being recognized by the person who opens it — the job.

Learning roadmap — follow in order
Basics 5 TOPICS
1
Time & Space Complexity
Core
Foundation of all DSA — measure how fast an algorithm runs (time) and how much memory it uses (space).
  • Big O, Big Θ, Big Ω notation
  • O(1) · O(log n) · O(n) · O(n²)
  • Best / average / worst case analysis
2
Arrays & Strings
Data Struct
The most fundamental data structures — contiguous memory blocks for storing elements sequentially.
  • Sliding window, two pointers, prefix sums
  • Subarray problems, rotation, reversal
  • String matching, anagrams, palindromes
3
Recursion
Algorithm
A function that calls itself to break a complex problem into smaller sub-problems until a base case is reached.
  • Base case + recursive case pattern
  • Call stack understanding, backtracking
  • Fibonacci, factorial, Tower of Hanoi
4
Searching & Sorting
Algorithm
Core algorithmic techniques to find elements efficiently and arrange data in order.
  • Linear search O(n) · Binary search O(log n)
  • Bubble, Selection, Insertion — O(n²)
  • Merge Sort, Quick Sort, Heap Sort — O(n log n)
5
Stacks & Queues
Data Struct
Linear structures with restricted access — stack is LIFO, queue is FIFO.
  • Stack: push/pop — undo, expression parsing
  • Queue: enqueue/dequeue — BFS, scheduling
  • Monotonic stack, deque, priority queue
Advanced 5 TOPICS
1
Linked Lists
Data Struct
Dynamic linear structure where nodes hold data and a pointer to the next node — no fixed memory allocation.
  • Singly, doubly, and circular linked lists
  • Reversal, cycle detection (Floyd's algorithm)
  • Merge sorted lists, find middle node
2
Hashing
DS + Algo
Maps keys to values via a hash function — enables O(1) average-case lookup, insert, and delete.
  • Hash maps (dict) and hash sets
  • Collision handling: chaining, open addressing
  • Frequency counting, two-sum, grouping
3
Bit Manipulation
Algorithm
Operate directly on binary representations — highly efficient, O(1) operations on integers.
  • AND, OR, XOR, NOT, Left/Right shift
  • Check/set/clear/toggle a specific bit
  • Count set bits, detect power of 2, swap
4
Trees
Data Struct
Hierarchical non-linear structure with a root node and child sub-trees — backbone of many real-world systems.
  • Binary Tree, BST, AVL, Heap, Trie
  • Traversals: Inorder, Preorder, Postorder, BFS
  • LCA, diameter, path sum, balanced check
5
Graphs
DS + Algo
Network of nodes (vertices) and edges — most powerful structure for modelling real-world relationships.
  • Directed/undirected, weighted/unweighted
  • BFS, DFS, Dijkstra, Bellman-Ford, Floyd-Warshall
  • Topological sort, Union-Find, MST (Kruskal/Prim)
Why DSA for ML / DS / AI?
Efficiency — ML pipelines process millions of data points; poor complexity = unusable models
Interviews — DSA is the most tested subject across FAANG, startups, and research roles
Problem-solving — teaches structured thinking, not just coding patterns
Foundations — Trees → decision trees; Graphs → GNNs; Hashing → feature lookup
Big O Quick Reference
O(1) — Constant · Hash map lookup, array index access
O(log n) — Logarithmic · Binary search, balanced BST ops
O(n) — Linear · Single array traversal, linear search
O(n log n) — Merge sort, heap sort, efficient sorts
O(n²) — Quadratic · Bubble/insertion sort, nested loops
O(2ⁿ) — Exponential · Brute-force recursion, avoid!

with by sv