#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 1::2.3.4 Basic Mathematical Properties of Trees (part 2)
#columns:Front	Back	Tags
TAOCP §2.3.4 Basic Mathematical Properties of Trees (part 2): what does it cover?	Part 2 covers counting trees (binary trees, oriented and free trees, labeled trees), path length and its role in measuring tree cost, Huffman's method for building optimal weighted trees, and the section's history, which comes with a few exercises on polygon dissections.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::about
TAOCP §2.3.4 (part 2): why does it matter?	Counting trees gives you Catalan numbers, which pop up everywhere. Huffman coding is used inside gzip, PNG and JPEG.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::why
TAOCP §2.3.4 (part 2), a common trap: “Confusing internal and external path length.” What's the catch?	Write out both for a small tree.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::trap
TAOCP §2.3.4 (part 2), exercise 8 of §2.3.4.4 (rated 20): what is it asking?	Draw all free trees on six vertices and mark their centroids.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 13 of §2.3.4.4 (rated 15): what is it asking?	Decode an oriented tree from its canonical sequence.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 16 of §2.3.4.4 (rated 25): what is it asking?	Convert that canonical sequence to parent links efficiently.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 22 of §2.3.4.4 (rated M20): what is it asking?	Count the labeled free trees on n vertices.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 2 of §2.3.4.5 (rated 17): what is it asking?	Build a minimum weighted path length tree by hand with Huffman's method.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 13 of §2.3.4.5 (rated 22): what is it asking?	Implement Huffman's method on sorted weights with fewer than 2m comparisons.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 1 of §2.3.4.6 (rated 21, recommended): what is it asking?	Match binary trees with triangulations of a polygon.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2), exercise 11 of §2.3.4.4 (rated M28, recommended): what is it asking?	Count t-ary trees by generalizing the binary tree count. The stretch.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercise
TAOCP §2.3.4 (part 2): how many exercises, and how are they rated?	54 exercises, rated 10 to HM40.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::exercises
TAOCP §2.3.4 (part 2): what should you be comfortable with first?	<ul><li>2.3.4 part 1</li><li>1.2.9 Generating Functions</li></ul>	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::prereqs
TAOCP §2.3.4 (part 2): how should you work through it?	Derive the count of binary trees with n nodes using a generating function before reading Knuth's derivation. Implement Huffman coding with a priority queue and compress a text file.	cracked.guide cracked.guide::phase::taocp-1 cracked.guide::section::2.3.4 cracked.guide::kind::approach
