Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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 countAboveBenchmarkMyTree 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 should return because there are two numbers: and are greater than
public class TreeNode implements ComparableLAB
Main.java
public class Main
public int countAboveBenchmarkMyTree mt int val
TO DO: count and return how many numbers in the tree are greater than or equals to the benchmark value.
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 should return because there are two numbers: and are greater than
Input above longrightarrow,longrightarrow Output below
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