Homework Assignment VII


Due Thursday May 15, 1997

Reading: Look up "Binary Search Tree" in any book you have.

1(10 points) For each part, show the binary search tree that would be created if
keys are in serted in the given order. a. S U P E R C A T
b. P E A C R U S T
c. P U R E C A S T
d. A C E P R S T U

2(8 points) For each part, start from the original tree1 and draw the resulting binary search tree after the node with the given key is deleted.



a. E

b. B

c. F








3(7 points)

Using tree1 and tree2, shown here, show separately, the results of the calls:

P(tree1, 0);
and
P(tree2, 0);
given the function:
void P(Node* t, int L){
	if (t){
		P(t->right, L+1);
		for (int i = 1; i <= L; i++)
			cout << "   ";
		cout << t->data << endl;
		P(t->left, L+1);
	};
};






Last Updated: May 12, 1997, 1997 8:44 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/HW7/hw7.html