Homework #3

 

CS 163 Data Structures

 

 

 

 

 

Answer the following questions:

 

Write C++ to determine the following for a binary search tree, implemented using a non-linear linked list:

 

1) Calculate the following:

            a) count the number of nodes in a binary search tree

            b) calculate the minimum height based on this number (mathematically)

            c) via traversal determine the actual height of this binary search tree

 

2) Write a function to count the number of leaves

 

3) Make a complete copy of a binary search tree

 

4) Draw some trees based on the following numbers to be inserted:

            20  35 60 75 15 12 30 70 7 19 75 65

 

            Create the 2-3, 2-3-4,Red Black, AVL trees … show your work!