Create a method countNotEqual
that accepts a BinaryTree<Int>?
and an Int
and returns a count of the
number of nodes in the tree that contain a value not equal to the passed value.
If the passed tree is null
you should return 0.
For reference, cs125.trees.BinaryTree<T>
is defined like this:
As a result, tree.value
is an Int
which you can compare to the passed value in the usual
way.
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: