| Algorithm | Time | Space | When to Use |
|---|---|---|---|
| Binary Search | O(log n) |
O(1) |
Sorted data, monotonic function |
| Two Pointers | O(n) |
O(1) |
Sorted arrays, palindromes |
| Sliding Window | O(n) |
O(k) |
Subarray/substring problems |
| BFS | O(V+E) |
O(V) |
Shortest path (unweighted) |
| DFS | O(V+E) |
O(V) |
Path finding, cycle detection |
| Dijkstra | O((V+E)log V) |
O(V) |
Shortest path (weighted) |
| Merge Sort | O(n log n) |
O(n) |
Stable sort needed |
| Quick Sort | O(n log n) |
O(log n) |
General purpose sorting |
| DP (1D) | O(n) |
O(n) |
Optimal substructure |
| DP (2D) | O(n²) |
O(n²) |
Two-sequence problems |
|
|
|
|
| # | Topic | Level | Problems | Description |
|---|---|---|---|---|
| 01 | Arrays | 🟢 Easy | 50+ | Two pointers, prefix sum, matrix operations |
| 02 | Strings | 🟢 Easy | 50+ | Pattern matching, palindromes, anagrams |
| 03 | Linked Lists | 🟢 Easy | 40+ | Reversal, merge, cycle detection |
| 04 | Stacks | 🟡 Medium | 35+ | Monotonic stack, expression evaluation |
| 05 | Queues | 🟡 Medium | 25+ | BFS, deque, priority queues |
| 06 | Hash Tables | 🟢 Easy | 40+ | Frequency counting, two sum pattern |
| 07 | Trees | 🟡 Medium | 60+ | Traversal, construction, LCA |
| 08 | Binary Search Trees | 🟡 Medium | 25+ | Validation, operations, balancing |
| 09 | Heaps | 🟡 Medium | 30+ | Top-K, merge K streams, two heaps |
| 10 | Graphs | 🔴 Hard | 80+ | BFS, DFS, shortest path, MST |
| 11 | Tries | 🟡 Medium | 15+ | Autocomplete, word search |
| 12 | Segment Trees | 🔴 Hard | 15+ | Range queries, lazy propagation |
| 13 | Union-Find | 🟡 Medium | 15+ | Connected components, cycle detection |
| # | Topic | Level | Problems | Description |
|---|---|---|---|---|
| 14 | Sorting | 🟢 Easy | 20+ | Comparison sorts, counting sort, custom |
| 15 | Binary Search | 🟡 Medium | 40+ | Sorted array, search on answer, 2D |
| 16 | Recursion | 🟡 Medium | 25+ | Backtracking, memoization, D&C |
| 17 | Backtracking | 🟡 Medium | 30+ | Permutations, subsets, N-Queens |
| 18 | Dynamic Programming | 🔴 Hard | 100+ | 1D, 2D, knapsack, tree DP, bitmask |
| 19 | Greedy | 🟡 Medium | 25+ | Interval scheduling, activity selection |
| 20 | Divide & Conquer | 🟡 Medium | 15+ | Merge sort pattern, quick select |
| 21 | Bit Manipulation | 🟡 Medium | 25+ | XOR tricks, bit counting, subsets |
| # | Topic | Level | Problems | Description |
|---|---|---|---|---|
| 22 | Two Pointers | 🟢 Easy | 30+ | Opposite direction, same direction |
| 23 | Sliding Window | 🟡 Medium | 25+ | Fixed size, variable size |
| 24 | Graph Algorithms | 🔴 Hard | 100+ | Advanced BFS/DFS, network flow |
| 25 | Tree Algorithms | 🔴 Hard | 80+ | Binary lifting, HLD, centroid |
| 26 | Sweep Line | 🟡 Medium | 20+ | Event processing, interval problems |
| 27 | Advanced Trees | 🔴 Hard | 30+ | AVL, Red-Black, B-Trees |
| 28 | String Algorithms | 🔴 Hard | 40+ | KMP, Z-algorithm, suffix array |
| 29 | Computational Geometry | 🔴 Hard | 20+ | Convex hull, line intersection |
| # | Topic | Level | Problems | Description |
|---|---|---|---|---|
| 30 | Number Theory | 🔴 Hard | 50+ | GCD, prime sieve, modular arithmetic |
| 31 | Combinatorics | 🔴 Hard | 50+ | Counting, generating functions |
| 32 | Game Theory | 🔴 Hard | 25+ | Nim, Sprague-Grundy, minimax |
| 33 | Matrix Exponentiation | 🔴 Hard | 25+ | Fast Fibonacci, linear recurrence |
| 34 | Sqrt Decomposition | 🔴 Hard | 20+ | Mo's algorithm, block decomposition |
| 35 | Persistent DS | 🔴 Hard | 20+ | Persistent segment tree, versioning |
| 36 | Randomized | 🟡 Medium | 25+ | Reservoir sampling, skip lists |
| 37 | Interval Trees | 🟡 Medium | 30+ | Interval scheduling, range updates |
| 38 | Online Algorithms | 🔴 Hard | 25+ | LRU cache, streaming algorithms |
| 39 | Approximation | 🔴 Hard | 20+ | Set cover, TSP approximation |
| 40 | DP Optimizations | 🔴 Hard | 60+ | Convex hull trick, divide & conquer |
| 41 | Loop Fusion & Online | 🔴 Hard | 30+ | Welford, Kadane, recurrence relations |
| Week | Focus Area | Topics | Goal |
|---|---|---|---|
| 1-2 | Foundations | Arrays, Strings, Hash Maps | Build strong basics |
| 3-4 | Core DS | Linked Lists, Stacks, Queues | Master linear structures |
| 5-6 | Search & Sort | Binary Search, Sorting | Understand divide & conquer |
| 7-8 | Recursion | Recursion, Backtracking | Think recursively |
| 9-10 | Trees | Binary Trees, BST, Heaps | Tree traversal mastery |
| 11-12 | Graphs | BFS, DFS, Shortest Path | Graph algorithms |
| 13-16 | DP | 1D, 2D, Advanced DP | Dynamic programming |
| 17+ | Advanced | Segment Trees, Number Theory | Competition level |
| # | Problem | Topic | Company |
|---|---|---|---|
| 1 | Two Sum | Hash Map | Google, Amazon, Meta |
| 2 | Valid Parentheses | Stack | All Companies |
| 3 | Merge Intervals | Sorting | Amazon, Microsoft |
| 4 | LRU Cache | Design | Meta, Amazon |
| 5 | Binary Tree Level Order | BFS | Google, Microsoft |
| 6 | Course Schedule | Topological Sort | Amazon, Google |
| 7 | Coin Change | DP | All Companies |
| 8 | Word Search | Backtracking | Meta, Amazon |
| 9 | Longest Substring | Sliding Window | All Companies |
| 10 | Clone Graph | DFS | Meta, Google |
Contributions are welcome! Here's how you can help:
-
🐛 Report bugs - Open an issue
-
💡 Suggest features - Share your ideas
-
📝 Improve docs - Fix typos, add examples
-
🔧 Submit PRs - Add problems, optimize solutions
If this repository helped you, please consider giving it a ⭐
Your support motivates continued development!
⭐ Star this repo if it helped you! ⭐
Made with ❤️ by Gaurav Goswami
Comprehensive DSA Guide • 830+ Problems • 41 Topics



