1( 8 points )
For the tree shown below, list the order in which the nodes are visited in:
|
|
2. (6 points)
Write a recursive C++ function that inputs, as an argument, a binary tree (i.e. a
pointer to the root node) and outputs the number of nodes in the tree that are right
children. (In the tree above, D, E, G, H, I are right children.)
3. (6 points)
For each of the expresions below, draw the corresponding expression tree and evaluate
the expression.
a. (preorder expression) + * 3 - + 9 2 1 5
b. (postorder expression) 7 5 - 6 + 5 2 * 9 4 - * +
Last Updated: May 18, 1997 2:32 pm by