Question: 5 . 1 7 NVCC Lab: Count values in a tree Please refer to the TreeNode.java and MyTree.java and implement the method as specified below:

5.17 NVCC Lab: Count values in a tree
Please refer to the TreeNode.java and MyTree.java and implement the method as specified below:
public int countAboveBenchmark(MyTree mt, int val)
This method takes a MyTree and a benchmark value (val) as parameters and count and return how many numbers in the tree are greater
than or equals to the benchmark value.
For example, given the following tree,
calling: countAboveBenchmark (mt,13) should return 2, because there are two numbers: 15 and 24 are greater than 13
public class TreeNode implements Comparable=LAB
Main.java
public class Main{
public int countAboveBenchmark(MyTree mt, int val){
//TO DO: count and return how many numbers in the tree are greater than or equals to the benchmark value.
}
}
7
Run your program as often as you'd like, before submitting for grading. Below, type any needed
input values in the first box, then click Run program and observe the program's output in the
second box.
Enter program input (optional)
countAboveBenchmark(mt,13) should return 2, because there are two numbers: 15 and 24 are greater than 13
Input (from above) longrightarrow,longrightarrow Output (shown below)
 5.17 NVCC Lab: Count values in a tree Please refer to

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!