Skip to content

Advanced -> Meet-In-The-Middle

Split a subset-like exact search into two halves, enumerate exact half summaries, and merge them faster than full 2^n brute force.

  • Topic slug: advanced/meet-in-the-middle
  • Tutorial page: Open tutorial
  • Ladder page: Open ladder
  • Repo problems currently tagged here: 1
  • Repo companion pages: 3
  • Curated external problems: 3

Microtopics

  • half-enumeration
  • subset-sums
  • sort-and-merge
  • hash-merge
  • n-around-40
  • sqrt-state-space

Learning Sources

Source Type
USACO Guide meet in the middle Reference
Competitive Programmer's Handbook Reference
Jeff Erickson - Algorithms Course

Practice Sources

Source Type
CSES Meet in the Middle Practice
SPOJ SUBSUMS Practice
AtCoder ABC184 F Practice

Repo Companion Material

Material Type
Meet-In-The-Middle hot sheet quick reference
Meet in the Middle note anchor note
Discrete Log note algebraic compare point

Curated External Problems

Core

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
Meet in the Middle CSES Medium-Hard Mitm Exact Search; Sort-And-Merge Subset Enumeration; Binary Search Subset-Sum; Counting The cleanest internal anchor for the classic half-sum enumeration route.
Programming Contest AtCoder Medium-Hard Mitm Exact Search; Optimization Subset Enumeration; Binary Search Best-Feasible-Sum; Binary Search A standard best-sum-no-more-than-S route where the merge is about best feasible complement rather than multiplicity.

Classics

Problem Source Difficulty Context Style Prerequisites Tags Why it fits
SUBSUMS SPOJ Medium-Hard Mitm Exact Search; Counting Subset Enumeration; Sorting Subset-Sum; Range Counting A classic SPOJ benchmark for half-sum generation with a counting-flavored merge.

Repo Problems

Code Title Fit Difficulty Pattern Note Solution
MEETINTHEMIDDLE Meet in the Middle primary medium-hard - Note Code

Regeneration

python3 scripts/generate_problem_catalog.py