This database contains essential Data Structures and Algorithms (DSA) patterns commonly used in coding interviews and problem-solving. This resource is designed to help learners quickly grasp and apply key algorithmic strategies across various contexts. Use this database to track mastery, practice problems, or as a quick reference guide during preparation.
| Pattern Name | Real Life Analogy | Problem Types |
|---|---|---|
| Sliding Window | Scanning items on a conveyor belt by looking at segments | Max sum subarray, unique substrings, window stats |
| Two Pointers | Checking pairs of shoes by moving fingers inward | Pair sums, duplicates removal, merging sorted arrays |
| Fast & Slow Pointers | Runners on a track laps—detecting when they meet | Cycle detection, finding middle, palindrome check |
| Merge Intervals | Merging overlapping meetings in a calendar | Schedule optimization, interval conflicts |
| Binary Search | Guessing a number between bounds, halving each time | Searching sorted array, peak finding |
| Prefix Sum | Cumulative receipts/account balance | Range-sum queries, subarray sum, equilibrium index |
| Dynamic Programming (1D) | Climbing stairs and noting best way at each step | Fibonacci, coin change, house robber |
| Dynamic Programming (2D) | Mapping best route on a grid | Unique paths, edit distance, longest common subsequence |
| Topological Sort | Scheduling courses with prerequisites | Course scheduling, dependency resolution |
| Breadth First Search (BFS) | Exploring a maze layer by layer | Shortest path, word ladder, tree level traversal |
| Depth First Search (DFS) | Exploring all cave branches before backtracking | Island counting, graph traversal, component detection |
| Linked List Manipulation | Flipping each link in a chain | Reverse list, merge lists, cycle detection |
| Union-Find (Disjoint Set) | Tracking groups of friends when new ones join | Connected components, cycle detection |
| Backtracking | Solving Sudoku by filling then erasing numbers | N-Queens, permutations, puzzle solving |
| Kadane's Algorithm | Finding longest winning streak in matches | Maximum subarray sum, circular subarray |
| Monotonic Stack | Stacking plates by size and removing from top | Largest rectangle, next greater element, daily temps |
| Trie (Prefix Tree) | Searching contacts by typing letters | Autocomplete, prefix search, dictionary problems |
| Heap / Priority Queue | To-do list ranked by urgency | Top-K elements, Dijkstra's, median stream |
| Bit Manipulation | Switching light bulbs using switches | Single number, count set bits, parity checks |
| Matrix Traversal | Exploring every room in a building | Spiral matrix, flood fill, word search |
| Counting Patterns | Counting types of cars passing a gate | Anagram groups, counting triplets, hashing freq |
| Bucket Sort / Counting Sort | Sorting coins by buckets per denomination | Top-K frequent, color sorting |
| Stack + Queue Hybrid | Delivering orders with FIFO & LIFO together | Min-stack, queue by stack, expression eval |
| Graph Traversals w/ Weight | Shortest paths on a city map | Dijkstra's, A* search, MST |
| Matrix Dynamic Programming | Robot finding shortest path on grid | Min path sum, unique paths, coin change II |
| Pattern Matching | Searching a word in a long sentence | KMP, Rabin-Karp, wildcard matching |
| Segment Tree | Making and answering database range queries | Range sum/query, lazy propagation |
| Sliding Window + Hashing | Tracking unique basket items as they slide by | Min window substring, anagram checking |
| In-place Transformation | Rearranging books on a shelf, no extra space | Rotate matrix, reverse words, flatten binary tree |
Get more resources here :