| |
Counting the Nodes in a Tree | page 5 of 8 |
A standard binary tree algorithm is to count the number of nodes in the tree. Here is a pseudocode version.
Count left subtree recursively
Count the current node as one
Count right subtree recursively
As you develop the code, consider what base case will terminate the recursion.
|