524
Graphs and Trees
17. a. For the following tree, write the leftmost child–right sibling array representation described in
Exercise 16.
1
2
3
4
5
6
10
7
8
9
1 1
b. Now draw the binary tree that results from treating the answer to part (a) as a left child–right
child binary tree representation. An arbitrary tree can thus be thought of as having a binary tree
representation.
18. The following binary tree is the representation of a general tree (as in part (b) of Exercise 17). Draw the
tree.
1
3
2
4
7
6
8
5
9
For Exercises 19–24, write the list of nodes resulting from a preorder traversal, an inorder traversal, and a
postorder traversal of the tree.
19.
a
b
d
e
f
g
c
h
20.
a
b
d
e
f
c
g
h
Précédent

- 541/986

Suivant