binary tree numNodes
<pre><code>int numNodes() const {
   int size = 1;

   if (left != NULL) size += left-&gt;numNodes();
   if (right != NULL) size += right-&gt;numNodes();

   return size;
}
</code></pre>

<p>the code above is the code to find number of nodes inside a tree, as it is using recursive call, I don't really understand what it does. could anyone please explain how recursive call or function above works. Thanks</p>

<p><hr /></p>

<h3>See also:</h3>

<ul>
<li><a href="http://stackoverflow.com/questions/717725/understanding-recursion">Understanding recursion</a></li>
</ul>
