Question: Write a program allows the user to enter and search for strings. When strings are added to the tree, theyshould be wrapped inside a node

Write a program allows the user to enter and search for strings. When strings are added to the tree, theyshould be wrapped inside a node object that holds the string, the frequency (number of times) with whichthat string has been added to the tree, and references to two other nodes (children). The strings must bestored in a Binary Search Tree. You will need to implement your own Binary Search Tree (you may use theone we covered in class as a starting point). A driver has been provided for you (TreeDemo.java). Youmust use that class as your driver, without alterations. Be sure to analyze the driver code (specifically themethods and manner in which the methods are called) to be sure that your program functions properly. In addition to the provided TreeDemo class, your project will also need two other classes:

1. BinarySearchTree This will serve as your container class. It needs to have functionality for adding nodes and searching (traversing) the tree.

2. Node Your Binary Search Tree will be made up of Node objects. Each node object must reference two children and also contain the string entered by the user and the frequency of that string.

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!