DSA Topics
Quick Nav
| Type | Notes |
|---|---|
| Complexity | [[Big O & Complexity]] |
| Sorting | [[Sorting Algorithms]] |
| Data Structures | [[Stack & Queue]] · [[Linked List]] · [[Trees & BST]] · [[Hash Map]] · [[Trie]] |
| Techniques | [[Arrays & Hashing]] · [[Two Pointers]] · [[Sliding Window]] · [[Prefix Sum]] · [[Stacks]] · [[Binary Search]] · [[Linked Lists]] · [[Trees]] · [[Tries]] · [[Heap & Priority Queue]] · [[Backtracking]] · [[Graphs]] · [[Dynamic Programming]] · [[Greedy]] · [[Merge Intervals]] · [[Bit Manipulation]] · [[Math & Geometry]] |
| SQL | [[SQL/SQL for Interviews]] ← moved to SQL/ folder |
This is a comprehensive, topic-by-topic breakdown of the DSA concepts required for SDE interviews (startups → FAANG). Each pattern links to a dedicated implementation note.
The list is organized by Data Structure, followed by the specific Algorithmic Patterns you need to master for that structure.
1. Arrays & Strings
Most interview questions (approx. 40%) start here. Mastery of indices and pointers is key.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Two Pointers | Using two pointers (start/end or same direction) to compare values. | Pair with Target Sum, Move Zeroes, Container With Most Water, Trapping Rain Water. |
| Sliding Window | Expanding/shrinking a window to satisfy a condition (usually for subarrays/substrings). | Longest Substring Without Repeating Characters, Minimum Window Substring, Max Sum Subarray of Size K. |
| Prefix Sum | Pre-calculating sums to answer range queries in $O(1)$. | Range Sum Query, Subarray Sum Equals K, Product of Array Except Self. |
| Cyclic Sort | Used when input array contains numbers in range 1 to N. | Find Missing Number, Find All Duplicates in an Array. |
| Kadane’s Algorithm | Optimized technique for Maximum Subarray Sum. | Maximum Subarray Sum, Maximum Sum Circular Subarray. |
2. Linked Lists
Focuses on pointer manipulation without using extra space.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Fast & Slow Pointers | Moving two pointers at different speeds (usually 1x and 2x) to detect cycles or find midpoints. | Linked List Cycle (Floyd’s Cycle Finding), Middle of the Linked List, Happy Number. |
| In-place Reversal | Reversing links strictly $O(1)$ space. | Reverse a Linked List, Reverse Linked List II (sub-list), Reverse Nodes in k-Group. |
| Merge Technique | Merging two sorted lists. | Merge Two Sorted Lists, Sort List (Merge Sort implementation). |
3. Stacks & Queues
Essential for processing nested structures and order-dependent problems.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Monotonic Stack | Keeping the stack sorted (increasing/decreasing) to find the "next greater/smaller" element efficiently. | Next Greater Element, Daily Temperatures, Largest Rectangle in Histogram. |
| Parentheses Matching | Using a stack to validate nested structures. | Valid Parentheses, Minimum Remove to Make Valid Parentheses. |
| Queue via Stacks | Implementing Queue using Stacks and vice versa. | Implement Queue using Stacks. |
4. Hashing (HashMaps & Sets)
The "Swiss Army Knife" of interviews. Used to reduce time complexity from $O(N^2)$ to $O(N)$.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Frequency Map | Counting occurrences of elements. | Top K Frequent Elements (with Heap), Valid Anagram, Group Anagrams. |
| Lookup / Caching | Storing seen elements for quick access. | Two Sum, Longest Consecutive Sequence. |
5. Trees (Binary Trees & BST)
Requires strong recursion skills.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| DFS (Pre/In/Post) | Depth-First Search for path finding or validating properties. | Path Sum, Validate BST, Lowest Common Ancestor (LCA), Diameter of Binary Tree. |
| BFS (Level Order) | Breadth-First Search using a Queue. | Binary Tree Level Order Traversal, Binary Tree Right Side View, Zigzag Level Order Traversal. |
| Morris Traversal | Advanced: Traversing tree with $O(1)$ space (no recursion stack). | Recover Binary Search Tree (Optimization). |
6. Heaps (Priority Queue)
Used whenever you need the "Min/Max" or "Top K" elements.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Top K Elements | keeping a heap of size K to find top elements. | Kth Largest Element in an Array, Top K Frequent Words. |
| Two Heaps | Maintaining a Min-Heap and Max-Heap simultaneously (often for Median). | Find Median from Data Stream, Sliding Window Median. |
| K-Way Merge | Merging multiple sorted lists using a Min-Heap. | Merge K Sorted Lists, Kth Smallest Element in a Sorted Matrix. |
7. Graphs
The most intimidating but systematic topic. Focus on "Traversals".
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Island Pattern (Matrix DFS/BFS) | Traversing a grid to find connected components. | Number of Islands, Max Area of Island, Rotting Oranges. |
| Union Find (Disjoint Set) | efficiently grouping elements and detecting cycles in undirected graphs. | Number of Provinces, Redundant Connection, Graph Valid Tree. |
| Topological Sort | Linear ordering of vertices (dependencies). Uses Indegree + Queue. | Course Schedule I & II, Alien Dictionary. |
| Dijkstra’s Algorithm | Shortest path in weighted graphs. | Network Delay Time, Cheapest Flights Within K Stops. |
8. Advanced Data Structures
Differentiators for Senior / FAANG roles.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Trie (Prefix Tree) | Efficient string search and prefix matching. | Implement Trie, Word Search II. |
| Segment Tree / BIT | Range queries with updates. | Range Sum Query - Mutable. |
9. Dynamic Programming (DP)
Optimization problems dealing with "Max/Min/Ways to do X".
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| 0/1 Knapsack | Decision making: Include item or not. | Partition Equal Subset Sum, Target Sum. |
| Unbounded Knapsack | Include item multiple times. | Coin Change, Coin Change II, Rod Cutting. |
| Longest Common Subsequence | String comparison logic. | LCS, Edit Distance, Longest Palindromic Subsequence. |
| Palindromic DP | Expanding from center or checking substrings. | Longest Palindromic Substring, Palindrome Partitioning. |
10. Greedy Algorithms
Make locally optimal choice at each step. No backtracking. Prove greedy choice works.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Activity Selection | Sort by end time, greedily pick non-overlapping intervals. | Meeting Rooms II, Non-Overlapping Intervals, Minimum Arrows to Burst Balloons. |
| Jump Game | Track furthest reachable index, decide feasibility. | Jump Game I & II, Gas Station. |
| Huffman / Priority | Build optimal structure by always picking min-cost elements. | Task Scheduler, Reorganize String. |
| Two-Pass Greedy | Scan left→right then right→left to propagate constraints. | Candy, Trapping Rain Water (greedy variant). |
11. Intervals
Sort by start time. Merge, insert, or count overlapping ranges.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Merge Intervals | Sort by start, merge overlapping pairs. | Merge Intervals, Insert Interval. |
| Min Platforms / Rooms | Sort starts + ends separately, sweep with pointer. | Meeting Rooms II, Minimum Number of Platforms. |
| Interval Intersection | Two-pointer merge of two sorted interval lists. | Interval List Intersections. |
→ Notes: [[Merge Intervals]]
12. Math & Geometry
Modular arithmetic, prime sieves, coordinate geometry.
| Pattern / Technique | Description | Common Problems |
|---|---|---|
| Modular Arithmetic | (a * b) % m to prevent overflow. | Pow(x, n) fast exponentiation, Factorial Trailing Zeroes. |
| Sieve of Eratosthenes | Find all primes up to N in O(N log log N). | Count Primes. |
| Geometry / Grid Math | Detect rectangles, rotate matrix, spiral order. | Rotate Image, Spiral Matrix, Set Matrix Zeroes. |
13. Other Essential Patterns
- Binary Search: Search space reduction, not just arrays (e.g., Koko Eating Bananas, Capacity To Ship Packages).
- Bit Manipulation: XOR tricks, bitmask subsets (e.g., Single Number, Sum of Two Integers).
- Backtracking: Brute force for combinations/permutations (e.g., Subsets, Permutations, N-Queens).
NeetCode 150 Progress (W1 starts May 11, 2026)
| Pattern | Status | Week |
|---|---|---|
| Arrays & Hashing | ✅ Done | pre-W1 |
| Two Pointers | ✅ Done | pre-W1 |
| Sliding Window | ✅ Done | pre-W1 |
| Stack | ✅ Done | pre-W1 |
| Binary Search | ✅ Done | pre-W1 |
| SQL | ✅ Done (separate) | pre-W1 |
| Linked List | ⬜ | W2 |
| Trees pt 1 | ⬜ | W3 |
| Trees pt 2 | ⬜ | W4 |
| Tries + Heap | ⬜ | W5 |
| Backtracking | ⬜ | W6–W7 |
| Graphs (BFS/DFS + Advanced) | ⬜ | W7–W8 |
| DP 1-D + DP 2-D | ⬜ | W9–W12 |
| Greedy + Intervals | ⬜ | W13–W14 |
| Math & Geometry | ⬜ | W15 |
| Bit Manipulation | ⬜ | W16 |
→ Full schedule: [[Coach/project_dsa_sd_curriculum]]
→ Current week: [[Coach/project_current_week]]