Create a public class BinaryTreeCountGreaterThan
that provides a single class method named
countGreaterThan
that accepts a BinaryTree<Integer>
and an int
and returns a count of the number of nodes in
the tree that contain a value greater than the passed value. If the passed tree is null
you should return 0.
For reference, cs125.trees.BinaryTree<T>
has the following public properties:
As a result, tree.getValue()
will return an Integer
, which you can compare to the threshold value in the usual
way.
Stuck? You may find these lessons helpful: