DSA Pattern Sheet
1. Arrays & Strings
1.1 Two Pointers
What it is: Use two indices moving towards each other or in the same direction.
Used for: Pairs, comparisons, partitioning, removing duplicates.
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
6. [Link]
7. [Link]
8. [Link]
1.2 Sliding Window (Fixed & Variable)
What it is: Maintain a window and adjust it based on constraints.
Used for: Subarray, substring, max, min, longest, count.
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
6. [Link]
7. [Link]
1.3 Prefix Sum
What it is: Store cumulative sums for fast range queries.
1. [Link]
2. [Link]
3. [Link]
4. [Link]
1.4 Kadane’s Algorithm
What it is: Optimized DP for max subarray problems.
1. [Link]
2. [Link]
1.5 Cyclic Sort
What it is: Place numbers at their correct indices.
1. [Link]
2. [Link]
3. [Link]
4. [Link]
2. Hashing
2.1 Frequency Map
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
2.2 Hash Set Pattern
1. [Link]
2. [Link]
3. Linked List
3.1 Fast & Slow Pointer
1. [Link]
2. [Link]
3. [Link]
3.2 Reversal Pattern
1. [Link]
2. [Link]
3. [Link]
3.3 Merge Pattern
1. [Link]
2. [Link]
4. Stack & Queue
4.1 Monotonic Stack
1. [Link]
2. [Link]
3. [Link]
4. [Link]
4.2 Queue / Deque Pattern
1. [Link]
2. [Link]
5. Binary Search
5.1 Classic Binary Search
1. [Link]
5.2 Binary Search on Answer
1. [Link]
2. [Link]
6. Recursion & Backtracking
6.1 Pick / Not Pick
1. [Link]
2. [Link]
6.2 Backtracking
1. [Link]
2. [Link]
7. Trees
7.1 DFS
1. [Link]
2. [Link]
7.2 BFS
1. [Link]
8. Graphs
8.1 BFS & DFS
1. [Link]
2. [Link]
3. [Link]
4. [Link]
8.2 Topological Sort
1. [Link]
2. [Link]
8.3 Union Find
1. [Link]
2. [Link]
3. [Link]
8.4 Dijkstra’s Algorithm
1. [Link]
2. [Link]
3. [Link]
4. [Link]
9. Heap
9.1 Top K Pattern
1. [Link]
2. [Link]
10. Dynamic Programming
10.1 0/1 Knapsack
1. [Link]
2. [Link]
10.2 Unbounded Knapsack
1. [Link]
2. [Link]
10.3 DP on Strings
1. [Link]
2. [Link]
3. [Link]
11. Greedy
11.1 Interval & Scheduling
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
11.2 Jump / Reachability
1. [Link]
2. [Link]
3. [Link]
11.3 Optimization
1. [Link]
2. [Link]
3. [Link]
4. [Link]
12. Bit Manipulation
12.1 XOR Based
1. [Link]
2. [Link]
3. [Link]
12.2 Bit Masking
1. [Link]
2. [Link]
3. [Link]
12.3 Bit Tricks
1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
12.4 Advanced Bit Manipulation
1. [Link]
2. [Link]
Credits
Created by: [Link]
Instagram: [Link]
Follow for more DSA, coding, and interview preparation content.