BinaryTree Count Not Equal
Geoffrey Challen // 2021.5.0
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.