#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 4A::7.2.1.3 Generating All Combinations
#columns:Front	Back	Tags
TAOCP §7.2.1.3 Generating All Combinations: what does it cover?	Generating all combinations: lexicographic order (Algorithms L and T), the binomial tree, revolving-door Gray codes, combinations with repetition and compositions, Chase's sequence and other near-perfect orders, a general genlex framework, combinations of a multiset, and the Kruskal-Katona theory of shadows, which says how small the shadow of a family of k-sets can be.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::about
TAOCP §7.2.1.3: why does it matter?	Subset enumeration is everywhere in brute-force search and testing. Gray-code orderings let you update a running computation in O(1) per step.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::why
TAOCP §7.2.1.3: what are Algorithms L and T about?	Lexicographic order.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::algorithm
TAOCP §7.2.1.3, fill in the blank:<br>Gray-code orderings let you update a running computation in <span class="cg-blank">&nbsp;</span> per step.	Gray-code orderings let you update a running computation in <b>O(1)</b> per step.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::complexity
TAOCP §7.2.1.3, exercise 5 (rated 20, recommended): what is it asking?	Generate integer solutions to chains of inequalities by mapping them to combinations.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 10 (rated 21, recommended): what is it asking?	List all World Series outcomes and index them neatly. Combinations in disguise.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 18 (rated 20, recommended): what is it asking?	See which binary tree the binomial tree becomes under child-sibling links.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 27 (rated 25, recommended): what is it asking?	Generate all subsets of size at most t with Gray-code-like moves.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 57 (rated 22, recommended): what is it asking?	Can a pianist play every chord in an octave moving one finger at a time? A revolving-door question.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 69 (rated M22, recommended): what is it asking?	Find the smallest family of k-sets whose shadow is smaller than the family. Gets you into Kruskal-Katona.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 110 (rated 26, recommended): what is it asking?	Score all cribbage hands by generating combinations. A real enumeration job.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3, exercise 111 (rated M26, recommended): what is it asking?	Prove the Erdős-Ko-Rado bound using shadows. The stretch.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercise
TAOCP §7.2.1.3: how many exercises, and how are they rated?	111 exercises, rated M01 to M49.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::exercises
TAOCP §7.2.1.3: what should you be comfortable with first?	<ul><li>7.2.1.2 Generating All Permutations</li></ul>	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::prereqs
TAOCP §7.2.1.3: how should you work through it?	Implement lexicographic combinations and a revolving-door order. Use the revolving door to maintain a running sum of selected elements cheaply.	cracked.guide cracked.guide::phase::taocp-4a cracked.guide::section::7.2.1.3 cracked.guide::kind::approach
