# Data Structures Algorithms
All Data Structures Algorithms notes →1 — Two Pointers Pattern
Recognizing when a problem's brute-force nested loop collapses to a single pass with two coordinated pointers.
10 — BFS Pattern
Recognizing shortest-path/level-order/minimum-step problems that breadth-first search solves optimally on unweighted graphs.
11 — Tree DFS Pattern
Recognizing tree problems that reduce to a DFS template carrying a small amount of state root-to-leaf.
12 — Graph Pattern
Recognizing problems phrased as text/grid/relationship data that are actually graph traversal or connectivity in disguise.
13 — Dynamic Programming Pattern
Recognizing optimal-substructure-plus-overlapping-subproblems phrasing that signals memoization or tabulation over brute force.
14 — Monotonic Stack Pattern
Recognizing next-greater/next-smaller-style problems that a monotonic stack solves in O(n).
15 — Union Find Pattern
Recognizing dynamic-connectivity and grouping problems that Union-Find solves faster than repeated traversal.
16 — Prefix Sum Pattern
Recognizing range-sum-query problems that precomputed prefix sums answer in O(1) per query.
17 — Heap Pattern
Recognizing 'k-th'/'top-k'/'median-of-stream' problems that a heap (or two heaps) solves without full sorting.
18 — Trie Pattern
Recognizing prefix-matching and autocomplete-style string problems that a trie solves faster than repeated string comparison.
2 — Sliding Window Pattern
Recognizing when a problem is secretly asking for a variable- or fixed-size window over a sequence.
3 — Fast & Slow Pointer
Recognizing cycle-detection and middle-of-sequence problems that Floyd's fast/slow pointer solves in O(1) space.
4 — Binary Search Pattern
Recognizing when a search space is monotonic enough to binary search over, even when there's no literal sorted array.
5 — Merge Intervals
Recognizing interval-overlap problems that reduce to sort-by-start-time plus a linear merge pass.
6 — Cyclic Sort
Recognizing array problems where values are bounded 1..n and can be placed at their own index in-place.
7 — Top K Elements
Recognizing 'k largest/smallest/most frequent' problems that a fixed-size heap solves in O(n log k).
8 — K-way Merge
Recognizing problems over k sorted sequences that a heap-based merge solves in O(n log k) instead of a full sort.
9 — DFS Pattern
Recognizing when exhaustive path/combination exploration is really depth-first search with backtracking.