make a function that counts the number of nodes in a tree
Anonymous
Use recursion, it's the best at problems like this! Think of the problem in these terms: 1.) An empty tree has 0 nodes 2.) Any other tree has one root node, plus however many nodes are in the left and right sub-trees. Now think of how to put that into code.
Check out your Company Bowl for anonymous work chats.