Phase 0: Python Foundations (2–3 weeks)
You must be comfortable with Python before DSA.
Learn:
Variables, data types
if / else
for, while
Functions
Lists, tuples, sets, dictionaries
List comprehensions
Basic recursion
Time complexity idea (Big-O basics)
Practice:
Reverse a number/string
Count frequency using dictionary
Fibonacci (iterative + recursive)
Phase 1: Complexity Analysis (3–4 days)
This decides how good your solution is.
Learn:
Time complexity: O(1), O(log n), O(n), O(n log n), O(n²)
Space complexity
Best, average, worst case
Practice:
Find complexity of simple loops
Nested loops analysis
Phase 2: Arrays & Strings (2 weeks)
These appear in almost every interview.
Learn:
Arrays (Python lists)
Sliding window
Two-pointer technique
Prefix sum
Strings (ASCII, Unicode basics)
Practice Problems:
Reverse array
Max subarray sum (Kadane)
Two sum
Anagram check
Longest substring without repeating characters
Phase 3: Recursion & Backtracking (1–1.5 weeks)
Learn:
Recursive call stack
Base case vs recursive case
Backtracking framework
Practice:
Factorial, Fibonacci
Subsets
Permutations
N-Queens
Generate parentheses
Phase 4: Searching & Sorting (1–1.5 weeks)
Searching:
Linear search
Binary search (very important)
Sorting:
Bubble, Selection, Insertion
Merge sort
Quick sort
Practice:
Binary search variations
Sort an array of 0s, 1s, 2s
Kth largest element
Phase 5: Linked List (1–1.5 weeks)
Learn:
Singly linked list
Doubly linked list
Fast & slow pointer
Practice:
Reverse linked list
Detect cycle
Merge two sorted lists
Find middle node
Phase 6: Stack & Queue (1 week)
Learn:
Stack (LIFO)
Queue (FIFO)
Deque
Monotonic stack
Practice:
Valid parentheses
Next greater element
Stock span problem
Implement stack using array
Phase 7: Hashing (1 week)
Learn:
Hash tables
Python dict and set
Collision idea (conceptual)
Practice:
Frequency counting
Two sum
Subarray sum equals k
Longest consecutive sequence
Phase 8: Trees (2 weeks) 🔥
Learn:
Binary tree
Binary search tree (BST)
Tree traversals (Inorder, Preorder, Postorder, Level order)
Practice:
Height of tree
Check balanced tree
Lowest common ancestor
BST search & insert
Phase 9: Heaps & Priority Queue (1 week)
Learn:
Min heap / Max heap
Python heapq
Practice:
K largest elements
Merge k sorted lists
Top K frequent elements
Phase 10: Graphs (2 weeks) 🔥🔥
Learn:
Graph representation
BFS & DFS
Cycle detection
Topological sort
Practice:
Number of islands
Detect cycle
Shortest path (BFS)
Connected components
Phase 11: Dynamic Programming (3 weeks) 🚀
Learn:
Recursion → Memoization → Tabulation
1D & 2D DP
Core Problems:
Fibonacci
Climbing stairs
Coin change
Longest common subsequence
Knapsack (0/1)
Phase 12: Advanced Topics (Optional but Powerful)
Trie
Segment tree
Disjoint set (Union-Find)
Bit manipulation
Greedy algorithms