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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started