Skip to content

Commit 3ca5e42

Browse files
committed
sudoku: docs
1 parent 9685c28 commit 3ca5e42

File tree

3 files changed

+642
-0
lines changed

3 files changed

+642
-0
lines changed
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
# The Competitive Programming Algorithm Toolbox
2+
3+
## **1. Basics & Foundations**
4+
5+
* **Prefix sums / Difference arrays**
6+
* **Two pointers / Sliding window**
7+
* **Binary search (on array, on answer, parametric search)**
8+
* **Sorting tricks (coordinate compression, custom comparators)**
9+
* **Hashing (rolling hash, string hashing, double hashing)**
10+
* **Modular arithmetic (mod inverse, fast exponentiation, CRT basics)**
11+
12+
---
13+
14+
## **2. Greedy Techniques**
15+
16+
* Interval scheduling (earliest finishing time)
17+
* Activity selection / Sweep line methods
18+
* Huffman coding (optimal merge patterns)
19+
* Greedy with sorting + priority queue (classic scheduling, intervals, tasks)
20+
* Exchange argument proofs
21+
22+
---
23+
24+
## **3. Divide & Conquer / Binary Search Variants**
25+
26+
* Divide & conquer DP optimization
27+
* Convex hull trick (for DP optimization)
28+
* Ternary search (on unimodal functions)
29+
* Meet-in-the-middle (subset sum, exponential problems)
30+
31+
---
32+
33+
## **4. Graph Theory**
34+
35+
* BFS / DFS (basic traversals)
36+
* Topological sort
37+
* Connected components (Union-Find / DSU)
38+
* Dijkstra's algorithm (with heap)
39+
* Bellman-Ford (for negative edges)
40+
* Floyd-Warshall (all-pairs shortest paths)
41+
* Minimum spanning tree (Kruskal, Prim)
42+
* Bridges & articulation points (Tarjan's algorithm)
43+
* Strongly connected components (Kosaraju, Tarjan)
44+
* Eulerian path / circuit (Hierholzer's algorithm)
45+
* Hamiltonian path (bitmask DP or backtracking)
46+
* Max flow (Ford-Fulkerson, Edmonds-Karp, Dinic)
47+
* Min-cost max flow
48+
* Bipartite matching (Hungarian, Hopcroft-Karp)
49+
* Network flow applications (assignment problems, circulation)
50+
51+
---
52+
53+
## **5. Trees**
54+
55+
* Binary lifting (LCA, ancestor queries)
56+
* Heavy-light decomposition (path queries)
57+
* Euler tour + RMQ trick for LCA
58+
* Centroid decomposition
59+
* Tree DP (classic rooted DP problems)
60+
* Rerooting techniques (DP on trees with re-root transitions)
61+
62+
---
63+
64+
## **6. Dynamic Programming**
65+
66+
* Classic 1D/2D DP (knapsack, LIS, edit distance, coin change)
67+
* Digit DP
68+
* Subset DP (bitmask DP)
69+
* SOS DP (sum over subsets)
70+
* Interval DP (matrix chain multiplication, optimal binary search trees)
71+
* DP on graphs (DAG longest path, etc.)
72+
* DP + bitmasks (traveling salesman)
73+
* DP with convex hull / divide & conquer optimization
74+
* Tree DP (independent set, diameter, etc.)
75+
76+
---
77+
78+
## **7. Advanced Data Structures**
79+
80+
* Segment tree (point update, range query)
81+
* Fenwick tree / BIT
82+
* Persistent segment tree (k-th order statistics)
83+
* Lazy propagation (range updates, range queries)
84+
* Treaps, Splay trees
85+
* Sparse table (RMQ, idempotent functions)
86+
* Disjoint set union (with path compression, union by rank)
87+
* Link-cut trees (dynamic trees)
88+
* Mo's algorithm (offline queries)
89+
* Wavelet trees (frequency/rank queries)
90+
91+
---
92+
93+
## **8. String Algorithms**
94+
95+
* KMP (pattern matching)
96+
* Z-function
97+
* Prefix function (pi array)
98+
* Rabin-Karp hashing
99+
* Suffix array (with LCP)
100+
* Suffix automaton
101+
* Aho-Corasick automaton (multiple pattern matching)
102+
* Manacher's algorithm (longest palindrome)
103+
* Trie / compressed trie
104+
* Rolling hash tricks (substring equality, palindrome checking)
105+
106+
---
107+
108+
## **9. Geometry & Math**
109+
110+
* Convex hull (Graham scan, Andrew monotone chain)
111+
* Rotating calipers (diameter, closest pair, width)
112+
* Line sweep algorithms (events, intersections)
113+
* Closest pair of points (divide & conquer)
114+
* Circle intersection, polygon area (shoelace formula)
115+
* Pick's theorem
116+
* Fast Fourier Transform (FFT, NTT for polynomial multiplication)
117+
* Matrix exponentiation
118+
* Linear algebra (Gaussian elimination, matrix rank)
119+
* Number theory (sieve of Eratosthenes, segmented sieve)
120+
* GCD/LCM, extended Euclidean algorithm
121+
* Modular inverse, Chinese remainder theorem
122+
* Euler's totient, Mobius function
123+
* Miller-Rabin primality test, Pollard rho factorization
124+
125+
---
126+
127+
## **10. Probability / Randomization**
128+
129+
* Monte Carlo algorithms (random primality testing)
130+
* Randomized hashing
131+
* Reservoir sampling
132+
* Randomized quicksort / treaps
133+
134+
---
135+
136+
## **11. Specialized Techniques**
137+
138+
* Bit tricks (lowest set bit, bit masks for subsets)
139+
* Meet-in-the-middle (for exponential search space)
140+
* Inclusion-exclusion principle
141+
* Fast Walsh-Hadamard transform (XOR convolutions)
142+
* Dynamic connectivity (DSU rollback, divide & conquer on queries)
143+
* Heavy-light + segment tree for dynamic paths
144+
* Sprague-Grundy theorem (Nim games, impartial games)
145+
146+
---
147+
148+
## **Russian-Style Problem-Solving Map**
149+
150+
### **1. Spotting Hidden Invariants**
151+
152+
| Technique | Example Problems | Difficulty | Note |
153+
| -------------------------- | ----------------------------------------------------------------- | ---------- | --------------------------------------------------- |
154+
| Track invariant quantities | [Game of Stones](https://codeforces.com/problemset/problem/359/B) | Medium | Find what never changes to simplify decision-making |
155+
| Parity / Modulus tricks | [Even-Odd Game](https://codeforces.com/problemset/problem/451/B) | Easy | Often reduces complex operations to parity checks |
156+
157+
---
158+
159+
### **2. Reduce to Canonical Form**
160+
161+
| Technique | Example Problems | Difficulty | Note |
162+
| --------------------------- | ---------------------------------------------------------------------------- | ---------- | -------------------------------------- |
163+
| Sorting / Normalizing input | [Remove Duplicate Intervals](https://leetcode.com/problems/merge-intervals/) | Medium | Makes greedy solutions apparent |
164+
| Coordinate compression | [Compressed Array Queries](https://codeforces.com/problemset/problem/276/C) | Hard | Reduce large ranges to smaller indices |
165+
166+
---
167+
168+
### **3. Backward Reasoning**
169+
170+
| Technique | Example Problems | Difficulty | Note |
171+
| -------------------------- | ------------------------------------------------------------------------ | ---------- | ----------------------------------- |
172+
| Reverse simulation | [Last Person Standing](https://codeforces.com/problemset/problem/602/B) | Medium | Think from end state to start |
173+
| Goal-oriented construction | [Constructing Sequence](https://codeforces.com/problemset/problem/977/C) | Medium | Build answer by reasoning backwards |
174+
175+
---
176+
177+
### **4. Extremal Principle**
178+
179+
| Technique | Example Problems | Difficulty | Note |
180+
| ---------------------------- | ----------------------------------------------------------------------------- | ---------- | --------------------------------------- |
181+
| Consider largest/smallest | [Maximum Pair Sum](https://codeforces.com/problemset/problem/489/C) | Medium | Anchor reasoning on extremal element |
182+
| First/last element as anchor | [Minimum Swaps to Sort](https://leetcode.com/problems/minimum-swaps-to-sort/) | Medium | Helps find forced moves and constraints |
183+
184+
---
185+
186+
### **5. Greedy Guess + Proof**
187+
188+
| Technique | Example Problems | Difficulty | Note |
189+
| ---------------------- | --------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------- |
190+
| Natural greedy choices | [Activity Selection](https://leetcode.com/problems/non-overlapping-intervals/) | Easy | Pick earliest end or largest gain and prove correctness |
191+
| Check if greedy fails | [Weighted Interval Scheduling](https://leetcode.com/problems/maximum-intervals-weight/) | Medium | Test greedy on small cases |
192+
193+
---
194+
195+
### **6. Simplify to 1D / Projection**
196+
197+
| Technique | Example Problems | Difficulty | Note |
198+
| ------------------------- | --------------------------------------------------------------------- | ---------- | ------------------------------------- |
199+
| Project 2D -> 1D | [Points on a Line](https://codeforces.com/problemset/problem/103/B) | Medium | Reduces complexity |
200+
| Treat features separately | [Skyline Problem](https://leetcode.com/problems/the-skyline-problem/) | Hard | Separate dimensions / simplify object |
201+
202+
---
203+
204+
### **7. Symmetry & Grouping**
205+
206+
| Technique | Example Problems | Difficulty | Note |
207+
| ------------------------------ | --------------------------------------------------------------------------- | ---------- | --------------------------- |
208+
| Treat equivalent objects alike | [Graph Coloring](https://codeforces.com/problemset/problem/1139/B) | Medium | Reduce state space |
209+
| Exploit symmetry | [Mirror Array Operations](https://codeforces.com/problemset/problem/1669/C) | Medium | Avoid redundant computation |
210+
211+
---
212+
213+
### **8. Small Examples & Pattern Guessing**
214+
215+
| Technique | Example Problems | Difficulty | Note |
216+
| ----------------------- | ----------------------------------------------------------------------------- | ---------- | ------------------------------ |
217+
| Test tiny inputs | [Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k/) | Medium | Reveals hidden patterns |
218+
| Explore all small cases | [Permutation Cycles](https://codeforces.com/problemset/problem/499/B) | Medium | Helps predict general behavior |
219+
220+
---
221+
222+
### **9. Count, Don't Simulate**
223+
224+
| Technique | Example Problems | Difficulty | Note |
225+
| ------------------------------- | ---------------------------------------------------------------------- | ---------- | -------------------------------------------- |
226+
| Combinatorial counting | [Counting Rectangles](https://codeforces.com/problemset/problem/166/B) | Medium | Count possibilities instead of brute-forcing |
227+
| DP / math instead of simulation | [Unique Paths](https://leetcode.com/problems/unique-paths/) | Medium | Mathematical shortcuts |
228+
229+
---
230+
231+
### **10. Transform Operations**
232+
233+
| Technique | Example Problems | Difficulty | Note |
234+
| ------------------------------------ | ----------------------------------------------------------------------------- | ---------- | ---------------------------------------------------- |
235+
| Replace swaps with position tracking | [Minimum Swaps to Sort](https://leetcode.com/problems/minimum-swaps-to-sort/) | Medium | Track positions instead of performing actual swaps |
236+
| Simplify operations | [Interval Addition](https://leetcode.com/problems/range-addition/) | Medium | Convert complicated operations to simpler arithmetic |
237+
238+
---
239+
240+
### **11. Problem Duality**
241+
242+
| Technique | Example Problems | Difficulty | Note |
243+
| --------------------- | -------------------------------------------------------------------------------------------- | ---------- | ---------------------------- |
244+
| Complement sets | [Number of Subsets](https://leetcode.com/problems/count-of-subsets/) | Medium | Solve “not A” instead of “A” |
245+
| Min → Max / Max → Min | [Minimize Max Distance](https://leetcode.com/problems/minimize-max-distance-to-gas-station/) | Medium | Flip perspective |
246+
247+
---
248+
249+
### **12. Memory-less Thinking / State Reduction**
250+
251+
| Technique | Example Problems | Difficulty | Note |
252+
| ------------------------- | -------------------------------------------------------------------------- | ---------- | ---------------------------- |
253+
| Reduce DP state | [House Robber III](https://leetcode.com/problems/house-robber-iii/) | Medium | Only store essential info |
254+
| Track key parameters only | [Game State Optimization](https://codeforces.com/problemset/problem/117/C) | Medium | Avoid storing entire history |

0 commit comments

Comments
 (0)