Description
Binary Search Tree (25 points)
Implement the following method:
• traverseByLevel
Complete the traverseByLevel() method. This method should return a string of integers
representing the traversal of the tree in level-order (or breadth-first order).
Hash Map (25 points)
Implement the following method:
• getAverage
Complete the getAverage() method. This method should accept two arguments, HashMap and
arr, where arr is an array of integers. The method then returns a computed average of the values
of each key found in both the array and HashMap.
For example, the keys 1, 2 from the array are
present in the HashMap, so the average is calculated as (10+20)/2 = 15. The keys ‘7’ and ‘8’ are
not present in the HashMap, so their corresponding values are not included in the average
calculation.
• odd
Complete the odd() method. This method should return an ArrayList with values of the
corresponding odd keys.
Hash Map – Separate Chaining Implementation (50 points)
Complete the methods replace(K,V,V), containsValue(V), and containsKey(K). Full
documentation is provided in main.java file located on Repl.it.
Submission:
1) Before submission, make sure your code passes all the JUnit tests. Keep in mind, however, that
passing the test cases does not guarantee that your code is correct or efficient. Your assignment
will be graded considering test results, correctness, and efficiency.
2) The submission should be completed in Replit.
3) Include your name and class number as comments at the top of each submitted Java file.