Question: Practicing Binary Search Tree's (JAVA ONLY) This practice exercise involves writing a program to translate English into Morse code using a binary search tree .

Practicing Binary Search Tree's (JAVA ONLY)

This practice exercise involves writing a program to translate English into Morse code using a binary search tree. Your program should prompt the user to specify an English sentence and then display the translated results by searching a binary search tree for each letter and determining the correct sequence of dots and dashes.

3 classes are needed, the Binary search tree and the Morse Class as well as application class

BST must contain both values

Practicing Binary Search Tree's (JAVA ONLY) This practice exercise involves writing a

  • Create a binary search tree using an insert ( ) function to fill the tree with each letter/Morse structure. You should arrange the tree so that it is alphabetically ordered from left to right. Your tree should be balanced - you will have to rearrange the Morse table to make sure that your lookup tree is balanced.
  • Display the binary search tree using pre-order, in-order, and post-order traversals.
  • Display the height of the binary search tree.
  • Prompt the user for an input sentences and display the Morse code result of each.

You may find the following declarations useful in building the binary search tree:

 String[] english = { "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", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ",", ".", "?" }; String[] morse = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".---.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----.", "-----", "--..--", ".-.-.-", "..--.." };

code Character ->>>> 3x U Digits code Character code Character ->>>> 3x U Digits code Character

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!