Create a method named oddSum
that accepts a BinaryTree<Int>?
,
that is a BinaryTree
containing Int
values.
Return the sum of all the odd values in the tree.
As a reminder, value % 2
returns a non-zero value if value
is odd.
For reference, cs125.trees.BinaryTree
is defined like this:
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: