Binary Tree Applications
CS2 Course Summary Slide 27

Two application programming problems are posed in the context of the binary tree package. Students are asked to:

  1. Write a MonthTest application program which creates a StringBinaryTree object containing the names of the months. Add the months chronologically (i.e., January, February, ...) in such a way that the names will be displayed alphabetically when an inorder traversal is performed on it. Perform the three traversals on the tree and compute its height.
  2. Write an ExpressionTest application program which creates an ObjectBinaryTree object containing the following expression: ( ( ( 11 + 5 ) / ( 7 * 6 ) ) - ( 33 - ( 9 * 16 ) ) ). Perform the three traversals on the tree and compute its height.