Why it matters
Meet-in-the-middle gives huge speedup for many exponential problems.
Advertisement
The architecture
Split input into halves.
Enumerate all subsets of each half.
Combine: for each subset of half 1, find matching in half 2.
Advertisement
How it works end to end
Subset sum: 2^(n/2) subsets in each; combine via sort + two pointer or hash.
Shortest path in graph up to 2^(n/2) states.
Complexity: memory O(2^(n/2)) too.