...

/

Solution Review: Number of Elements

Solution Review: Number of Elements

Let’s take a detailed look at the previous challenge’s solution.

We'll cover the following...

Solution

We find the number of nodes (or all the elements) in a binary tree by summing the following

  • The number of nodes in the right subtree.
  • The number of nodes in the left subtree.
  • Adding 1 to the sum of the above.
...