Recursion & Search
Backtracking (enumerate all configurations with pruning) and Cyclic Sort (in-place 1..n placement).
1 min readInterview · DSA Patterns
Backtracking
Choose → recurse → unchoose. Subsets, perms, combos, N-Queens.
Cyclic Sort
Array of 1..n → swap each value to its index. O(n) / O(1) space.
Finished reading?
Mark it done to track your progress in Interview.
Heap / Top-K / Two Heaps / K-way Merge
A heap (priority queue) lets you maintain the K best while streaming through data in O(log K) per element. Three variants cover essentially every heap-flavored interview problem.
Backtracking
Choose → recurse → unchoose. Systematically enumerate solutions to combinatorial problems with pruning. The universal template for subsets, permutations, combinations, N-Queens, and constraint satisfaction.