Exercise · Volume 1 · 2.3-1
Exercise 2.3-1
not stated yet in Lean solution written
| Rating | 18 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 2.3 of Volume 1 |
The task
A tree has the three nodes , , . Count the different ordered trees that can be formed, where the order of the subtrees of a node matters.
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
Choose the root first. Then look at the two ways in which the other two nodes can hang below it.
Hint 2
The other two nodes are either two one-node subtrees, in two orders, or one subtree with two nodes.
Solution
Show the solution
There are three choices for the root. Say the root is . The nodes and then form the subtrees of in one of two ways.
Case 1: two subtrees with one node each. They can stand in the order or in the order . This gives 2 trees.
Case 2: one subtree with both nodes. Its root is or , and the other node is its only child. This gives 2 trees.
So each root gives trees, and the total is .
Answer: 12.
Check
A python3 program built every ordered tree on the labels as a nested tuple and counted them. The counts for are . They agree with the formula , where is the Catalan number. For this is .
Remarks
The count for trees where the order of siblings does not matter is exercise 2.3-2.
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.