CS111 Programming Assignment 8
Binary Search Trees

Program 1

      Using the BinaryTree class you constructed in Lab 14, add the following member functions. Write a driver program to test these functions.

      1. Write a definition and implementation of the function, CountNodes, that returns the number of nodes in the binary tree.
      2. Write a definition and implementation of the function, singleParent, that returns the number of nodes in the binary tree that have only one child.


Program 2

      Using a Binary Search Tree, write a program to decode a Morse code messge.

      1. Write a definition for a MorseTree class. Include a member function for inserting standard codes into the Morse tree.
      2. Create a file containing the implementation of the member functions for the MorseTree class. Use the Morse codes in the box below.
      3. Create a test driver that decodes at least four sentences.

      A: .-
      B: -...
      C: -.-.
      D: -..
      E: .
      F: ..-.
      G: --.
      H: ....
      I: ..
      J: .---
      K: -.-
      L: .-..
      M: --
      N: -.
      O: ---
      P: .--.
      Q: --.-
      R: .-.
      S: ...
      T: -
      U: ..-
      V: ...-
      W: .--
      X: -..-
      Y: -.--
      Z: --..