Sorting Algorithms
All 8 major sorts: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, Radix. Know which to use when.
Binary Search
Search in O(log n). But it's not just for sorted arrays — works on monotonic functions, rotation, and boundaries.
Recursion
Solving problems by breaking them into smaller versions of themselves. Call stack, base cases, and recursion trees.
Dynamic Programming
The hardest and most rewarding technique. Memoization + tabulation. Coin Change, LCS, Knapsack, and 50+ patterns.
Greedy Algorithms
Always pick the locally optimal choice. When it works, it's elegant and fast. Activity Selection, Huffman, Jump Game.
Backtracking
Explore all possibilities and backtrack when stuck. N-Queens, Sudoku Solver, Permutations, Subsets, Word Search.
Divide & Conquer
Split the problem, solve subparts, merge results. Merge Sort, Quick Sort, Binary Search, POW(x,n), and more.
Identify the DP pattern
Does the problem ask for max/min/count of ways? Do choices affect future choices? If yes — likely DP.
Keywords: "maximum", "minimum", "number of ways", "can you reach"Define the state
What does dp[i] represent? This is the hardest step. Be explicit: "dp[i] = max sum of subarray ending at index i"
dp[i][j] = min cost to reach cell (i,j)Write the recurrence
How does dp[i] relate to dp[i-1] or smaller subproblems? This is your transition formula.
dp[i] = max(dp[i-1] + arr[i], arr[i]) ← Kadane'sBase case
What's the smallest subproblem you can answer directly without recursion?
dp[0] = arr[0] (first element is its own max subarray)Bottom-up or Top-down?
Top-down = recursion + memoization (easier to write). Bottom-up = iterative table (usually more efficient).
Both are equivalent. Start with top-down for understanding.Start from what the problem is asking, not from the algorithm you know best. Click a leaf to jump to that module.