Binary Tree Size
Create a public class
BinaryTreeSize that provides a single static method
size accepts a
BinaryTree that can contain any value, and returns the number of
nodes it contains.
You'll want to count recursively, identifying both a base case and a recursive step.
cs125.trees.BinaryTree has the following public properties:
Don't overthink this! Like many recursive algorithms, the solution is elegant and simple: 4 lines total if you do
You'll also need to import
cs125.trees.BinaryTree for this and similar problems.