CS111 Programming Assignment 8
Binary Search Trees
Instructor: Trish Cornez
Program 1
Using the BinaryTree class you constructed in Lab 14, add the following member functions. Write a driver program to test these functions.
Write a definition and implementation of the function,
CountNodes
, that returns the number of nodes in the binary tree.
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.
Write a definition for a MorseTree class. Include a member function for inserting standard codes into the Morse tree.
Create a file containing the implementation of the member functions for the MorseTree class. Use the Morse codes in the box below.
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: --..