Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in Java please CS 114, Spring 2023, Prof. Calvin Problem set #7 Due: Wednesday March 8, 1:00 pm. The assignment comprises two parts. (1) Add
in Java please
CS 114, Spring 2023, Prof. Calvin Problem set \#7 Due: Wednesday March 8, 1:00 pm. The assignment comprises two parts. (1) Add a method levelorderElements() to the BST.java binary search tree dictionary implementation on Vocareum. In level order the root comes first, then all nodes of level 1 , then all nodes of level 2, and so on. Within a level, the order is left to right; i.e., in ascending order. Model your method on inorderElements(). Test your method by changing the calls to inorderElements() in values() to levelorderElements(). This way, values() will return the values in the dictionary in level order. Test your class using the program PrintLevels.java. Hint: Preorder traversals make use of a stack through recursive calls. Consider making use of another data structure to help implement the levelorder traversal. (2) The BST class has a method range() with the following declaration: public Iterable range(K a, K b ) Passed a low key value a and a high key value b, range should return an ArrayList that contains all the dictionary values with key between a and b, inclusive, in order. The range method relies on the rangehelp method, which is not fully implemented. Complete the definition of rangehelp. Use the program PrintRange.java to test your method. It reads in the shuffled cmu pronunciation dictionary and creates a dictionary keyed on word. The program reads two strings from the terminal, and prints out all records with keys that fall between the two given strings, inclusive. Your range method should visit as few nodes in the BST as possible. For example, with input DOFF DOG PrintRange should produce the output DOFF D A01 F DOFFING D AO1 F IHO NG DOFFS D A01 F S DOG D A01 GStep 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