Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

  • 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

Explain the various techniques of Management Development.

Answered: 1 week ago