Fall 2001 CSCI 333 Homework 4

This assignment is due Wednesday, 17 October.

Problem 1

Build a binary search tree by starting with an empty tree and then adding, in order, the eight values 13, 14, 20, 11, 99, 77, 33, and 50.

Problem 2

Now show the binary search tree that results from removing, in order, the values 77, 13, and 20 from the tree you constructed in Problem 1.

Problem 3

Start with an array containing the six values 13, 14, 20, 11, 99, 77, and 33 stored sequentially in this order. Now "run" the efficient heap building procedure described in Section 5.5 and illustrated in Figure 5.21(b) on this array to build a minheap stored within an array.

Problem 4

Remove the two smallest elements from the heap created in Problem 3. Be sure to restore the heap to the proper format.

Problem 5

Add the elements 88 and 12 to the heap created in Problem 3. Again, be sure to restore the heap to the proper format.

Problem 6

Do problem 5.14 of the textbook. You don't have to actually run your function. You can just write it out and turn it in.