Named algorithms [mp]
Micro pattern¶
Description¶
Apply a standard algorithm whose established invariant fits the input and objective.
Problems¶
Sorting algorithms¶
Choose a known sorting strategy for the representation and constraints.
- Bubble sort (DSA)
- Top-down merge sort (DSA)
- Top-down merge sort linked list (DSA)
- Bottom-up merge sort (DSA)
- Bottom-up merge sort linked list (DSA)
- Quick sort (DSA)
- Bucket sort (DSA)
- LSD radix sort (DSA)
- Counting sort (DSA)
- Heap sort (DSA)
- Shell sort (DSA)
- Insertion sort (DSA)
- Insertion sort linked list (DSA)
- Selection sort (DSA)
- 148. Sort List (Top Hard)
Array and randomization algorithms¶
Apply an established scan, partition, placement, or shuffle algorithm.
- 53. Maximum Subarray (Top Easy)
- 75. Sort Colors (Top Medium)
- 384. Shuffle an Array (Top Easy)
- 41. First Missing Positive (Top Hard)
Number theory¶
Use a standard sieve or sum-of-squares theorem.
- 204. Count Primes (Top Easy)
- 279. Perfect Squares (Top Hard)
Voting algorithms¶
Use cancellation to find a bounded number of majority candidates.
- 169. Majority Element (Top Medium)
- 229. Majority Element II (Google Prep)
Graph search¶
Use established graph traversal, cycle, or topological algorithms.
- 127. Word Ladder (Top Hard)
- 287. Find the Duplicate Number (Top Hard)
- 207. Course Schedule (Top Hard)
- 210. Course Schedule II (Top Hard)
- 329. Longest Increasing Path in a Matrix (Top Hard)
- 802. Find Eventual Safe States (Graph Theory)
- 1192. Critical Connections in a Network (Graph Theory)
- 1203. Sort Items by Groups Respecting Dependencies (Graph Theory)
- 1857. Largest Color Value in a Directed Graph (Graph Theory)
Disjoint-set algorithms¶
Merge equivalence classes and query their representatives.
- 990. Satisfiability of Equality Equations (Graph Theory)
- 1061. Lexicographically Smallest Equivalent String (Graph Theory)
- 839. Similar String Groups (Graph Theory)
Range-query structures¶
Maintain prefix frequencies under point updates.
- 315. Count of Smaller Numbers After Self (Top Hard)