#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::1.3.3 Applications to Permutations
#columns:Front	Back	Tags
TAOCP §1.3.3 Applications to Permutations: what does it cover?	Permutations written in cycle notation, how to multiply them (two algorithms and MIX programs), and how to invert a permutation in place in memory. It closes with counting: how many cycles a random permutation has, fixed points, and inclusion and exclusion. It mixes the math from 1.2 with the programming from 1.3.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::about
TAOCP §1.3.3: why does it matter?	In-place permutation and cycle-following are real techniques: think in-place array rotation, transposing matrices, and shuffling. The analysis also introduces counting cycles in random permutations.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::why
TAOCP §1.3.3, a common trap: “Multiplying permutations in the wrong order.” What's the catch?	Knuth composes left to right; many textbooks do the opposite.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::trap
TAOCP §1.3.3: what traps should you watch for?	<ul><li>Forgetting to mark visited elements when following cycles in place.</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::traps
TAOCP §1.3.3, exercise 1 (rated 02): what is it asking?	Show that doubling mod 7 permutes 0 to 6 and write its cycles.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 4 (rated 10): what is it asking?	Multiply out a product of cycles into disjoint cycles by hand.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 5 (rated M10, recommended): what is it asking?	Count the ways to write one permutation in cycle form.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 8 (rated 23, recommended): what is it asking?	Decide whether the right-to-left multiplication algorithm could run left to right.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 11 (rated 15): what is it asking?	Find the rule for inverting a permutation given in cycle form.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 13 (rated M24, recommended): what is it asking?	Prove the second in-place inversion algorithm correct.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 34 (rated M25, recommended): what is it asking?	Swap two adjacent blocks of an array in place. The rotation trick behind many library routines.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3, exercise 12 (rated M27): what is it asking?	Transpose a non-square matrix in place by following cycles. The stretch, and genuinely useful.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercise
TAOCP §1.3.3: how many exercises, and how are they rated?	36 exercises, rated 02 to HM42.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::exercises
TAOCP §1.3.3: what should you be comfortable with first?	<ul><li>1.3.2 The MIX Assembly Language</li><li>1.2.5 Permutations and Factorials</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::prereqs
TAOCP §1.3.3: how should you work through it?	Do several cycle-notation multiplications by hand until you can do them fast. Then implement in-place inversion of a permutation array in C or Python before reading the MIX version. Compare approaches.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::1.3.3 cracked.guide::kind::approach
