#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 4B::7.2.2 Backtrack Programming (part 2)
#columns:Front	Back	Tags
TAOCP §7.2.2 Backtrack Programming (part 2): what does it cover?	Part 2 covers the rest of 7.2.2 (pages 46 to 54). It shows how to estimate the running time of a backtrack program before running it, by following random paths down the tree (Algorithm E), and why the estimate is unbiased. An optional starred part uses the same idea to estimate the number of solutions, with king paths on a chessboard as the example. Then 'factoring the problem' splits a search into independent pieces, using the Instant Insanity cube puzzle. The section ends with historical notes.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::about
TAOCP §7.2.2 (part 2): why does it matter?	Estimating search cost is a superpower: you can tell in seconds whether a search will take a minute or a million years.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::why
TAOCP §7.2.2 (part 2): what is Algorithm E about?	Following random paths down the tree.<div class="cg-dim cg-ctx">It shows how to estimate the running time of a backtrack program before running it, by following random paths down the tree (Algorithm E), and why the estimate is unbiased.</div>	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::algorithm
TAOCP §7.2.2 (part 2), a common trap: “Trusting a single random estimate.” What's the catch?	The variance is huge; average many probes.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::trap
TAOCP §7.2.2 (part 2), a common trap: “Thinking the estimator is biased because single runs are wildly off.” What's the catch?	It is unbiased; it just has high variance.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::trap
TAOCP §7.2.2 (part 2), exercise 49 (rated 20): what is it asking?	Trace how the random bits in the figure produced each choice in a sample probe.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 60 (rated 20, recommended): what is it asking?	Try weighting king moves to bias the random walk, and see whether the estimates get better.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 62 (rated 22, recommended): what is it asking?	Estimate how often four randomly colored cubes give an Instant Insanity puzzle with exactly one solution.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 66 (rated 23, recommended): what is it asking?	Show that a rotating-disks puzzle factors into small independent pieces you can solve by hand.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 52 (rated HM25, recommended): what is it asking?	Connect Algorithm E on a simple decreasing-sequence tree to a coin-flipping process.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 56 (rated M25, recommended): what is it asking?	Figure out how to estimate the running time of the commafree search, which does not fit the plain Algorithm E mold.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 75 (rated 30, recommended): what is it asking?	Design a backtrack generator for all connected vertex subsets of a graph that contain a given vertex.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2), exercise 53 (rated M30, recommended): what is it asking?	The stretch: extend Algorithm B to report the minimum, maximum, mean and variance of the Monte Carlo estimates.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercise
TAOCP §7.2.2 (part 2): how many exercises, and how are they rated?	31 exercises, rated M15 to 41.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::exercises
TAOCP §7.2.2 (part 2): what should you be comfortable with first?	<ul><li>7.2.2 part 1</li><li>Mathematical Preliminaries Redux</li></ul>	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::prereqs
TAOCP §7.2.2 (part 2): how should you work through it?	Implement Algorithm E for your n queens program from part 1. Compare the averages of many random probes with the true node counts, and look at how widely single estimates vary. Then solve Instant Insanity by hand using the factoring idea.	cracked.guide cracked.guide::phase::taocp-4b cracked.guide::section::7.2.2 cracked.guide::kind::approach
