Exercises
Trees
Use the figure below to answer the following questions.
- What is the root?
- What is the height of the tree?
- List the descendants of B.
- List the siblings of W.
- List the children of C.
- List the ancestors of Z.
- What is the parent of J?
- Which nodes are leaves?
- What is the level of W?
- What is the depth of Y?
- What is the maximum number of nodes in a binary tree of
- height 3?
- height 10?
- height h?
- What is the maximum number of leaves in a binary tree of
- height 3?
- height 10?
- height h?
- Draw the tree indicated by this array:
| L | R |
1 | 4 | 0 |
2 | 0 | 5 |
3 | 2 | 1 |
4 | 0 | 0 |
5 | 6 | 0 |
6 | 0 | 0 |
- What does this tree represent in the "real world?"
Continue to: Unit 8 / Prev / Next