Exercises - Lecture 8
8A
For the first two problems, consider the following five structures, which can be referred to by the label of their root elements (A through E):
- Which of the above are trees?
- Which of the above are binary trees?
8B
For all remaining exercises in this set, refer to the tree pictured below:
- What’s the root of G’s right subtree?
- List the ancestors of F.
- What’s C’s parent?
- List the nodes at depth 1?
- List the nodes that are the root of a subtree of height 0.
- What’s the height of the tree rooted at G?
- What’s the depth of node D?
8C
- Write the nodes in the order they are visited by a pre-order traversal.
- Write the nodes in the order they are visited by a in-order traversal.
- Write the nodes in the order they are visited by a post-order traversal.