Homework Assignment VI


Due Thursday May 8, 1997

Reading: Astrachan pages 596-605
Ford & Topp pages 533-564
1(18 points) For each of the three trees shown here, list the order in which the nodes are visited in:
a. preorder
b. postorder
c. inorder
d. level order


2. Define the height of an empty tree as 0 and the height of a nonempty tree as the number of nodes on the longest root-to-leaf path.
a. (1 point) What is the minimum height of a binary tree that contains 31 nodes?
b. (1 point) What is the maximum height of a binary tree that contains 31 nodes?
c. (5 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 height of the tree.


Last Updated: May 5, 1997, 1997 6:19 pm by

Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1101/HW/HW6/hw6.html