Exercise · Volume 1 · 2.3-22
Exercise 2.3-22
not stated yet in Lean solution written
| Rating | 21 |
|---|---|
| Markers | recommended |
| Kind | Informal: the exercise has no formal statement, so Lean does not state it from the written solution |
| Section | Section 2.3 of Volume 1 |
The task
Design a picture of a binary tree that uses the A-series paper sizes, where cutting a sheet in half gives two sheets of the next size, and draw tree (1) of Section 2.3.1 in it.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
The A sheets all have the ratio . Cut a sheet across its long side, and the two halves are again of this ratio, turned by a quarter turn.
Hint 2
Let a node be a point at the center of its sheet. Its subtrees take the two halves.
Solution
Show the solution
Scheme. The picture of a binary tree is built by recursion on a rectangle of ratio .
- If the tree is empty, draw nothing.
- Otherwise draw a dot at the center of the rectangle. Cut the rectangle across its long side into two halves. Each half has the ratio again, so it is a smaller sheet turned by a quarter turn.
- Draw the left subtree in the first half (the left half or the top half) and the right subtree in the second half, by the same rule. Join the dot to the center dots of the two subtree pictures with straight segments.
Every rectangle has the same shape, so the rule can go on without end. The area of the sheet of a node is half the area of the sheet of its parent, so a node at level has the area of the page. Segments do not cross: the segments from a node run along the axis through its center that is parallel to the long side of its sheet, and each segment stays inside the sheet of the node.
Tree (1) is with left subtree (whose left child is ) and right subtree . The node has the left subtree (with right child ) and the right subtree , whose children are and . Take a sheet of width and height with the origin at the top left. The cuts alternate: vertical for , horizontal for and , vertical for , and . The centers of the nodes, computed by python3, are:
| node | ||
|---|---|---|
| 0.707 | 0.500 | |
| 0.354 | 0.500 | |
| 1.061 | 0.500 | |
| 0.354 | 0.250 | |
| 1.061 | 0.250 | |
| 1.061 | 0.750 | |
| 1.237 | 0.250 | |
| 0.884 | 0.750 | |
| 1.237 | 0.750 |
The edges are to and , to , to and , to , and to and . The sketch below shows the picture, with the long side horizontal. The colons mark the first cut.
|-----------------------------|
| D : E--G |
| | : | |
| B------A-------C |
| : | |
| : H---F--J |
|-----------------------------|
The computer check showed that all nine sheets have the ratio to or its inverse.
Remarks
Knuth's answer gives two other layouts, one with the root as a line and one with boxes for empty subtrees. The layout above differs from both, since it draws a dot at the center of the sheet. Which layout is best depends on whether the information is in the nodes or in the empty subtrees.
This solution is drafted, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.