Homework 4

Due Date: Midnight, Tuesday, November 21
(NOTE: NO LATE HOMEWORKS WILL BE ACCEPTED.)

Assignment:

  1. Write a template class definition for a binary tree class called BinTree. The class defintion must contain the following operations:

  2. Embed the BinTree class definition in a complete C++ header file called BinTree.H.

  3. Write stub (dummy) methods for each of the operations listed above. For example, for a method called anyMethod that has no parameters and returns an integer, the stub would look like: template <class T> int BinTree<T>::anyMethod() { return(1); }

    Place these methods in a file called BinTree.C.

  4. Write a template class definition for a binary tree node class called BTNode. The class defintion must contain the following operations:

    Make the BinTree class a friend of the BTNode class.

  5. Embed the BTNode class definition in a complete C++ header file called BTNode.H.

  6. Write stub (dummy) methods for each of the operations listed above. Place these methods in a file called BTNode.C.

  7. Write a main function that simply instantiates an object of type BinTree. Place the main function in a file called main.C.

  8. Create a makefile to compile and link your code into an executable called hw4.

Homework Submission

Submit your makefile and all five source code files using the usual submit process.

Last Modified: Tuesday, 14-Nov-2000 13:06:43 EST