Question: Write a recursive method for the class BinaryTree that counts the number of times an object occurs in a tree. (Note that this method is
Write a recursive method for the class BinaryTree that counts the number of times an object occurs in a tree. (Note that this method is just for binary trees- not a more specific kind of tree.)
The method header is:
public int count(T anObject)
Hint: write a private helper method: countHelper(BinaryNodeInterface
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
