TAOCP 2.3 Exercise 17

The node `Z[1,2,2]` is the second child of the second child of the first tree in the forest `Z`.

Section 2.3: Trees

Exercise 17. [**] [01] If Z stands for Fig. 19 regarded as a forest, what node is parent(Z[1,2,2])?

Verified: no
Solve time: 33s


The node Z[1,2,2] is the second child of the second child of the first tree in the forest Z. By definition of the parent function in Section 2.3, the parent of a node is the node immediately preceding it in the path from the root. The path from the root to Z[1,2,2] is [1] (root), then [1,2] (second child of the root), then [1,2,2] (second child of that node). Hence the parent of Z[1,2,2] is Z[1,2].

$\boxed{Z[1,2]}$