title: Recursively count the number of leaves in a binary tree without given parameters
body: <p>I am struggling to figure out how to code a recursive algorithm to count the number of leaves in a Binary Tree (not a complete tree). I get as far as traversing to the far most left leaf and don't know what to return from there. I am trying to get the count by loading the leaves into a list and getting the size of that list. This is probably a bad way to go about the count.</p>
  
  <pre><code>    public int countLeaves ( ) {
  
      List&lt; Node&lt;E&gt; &gt; leafList = new ArrayList&lt; Node&lt;E&gt; &gt;();
      //BinaryTree&lt;Node&lt;E&gt;&gt; treeList = new BinaryTree(root);
  
      if(root.left != null) 
      {
          root = root.left;
          countLeaves();
      }
      if(root.right != null) 
      {
          root = root.right;
          countLeaves();
      }
      if(root.left == null &amp;&amp; root.right == null) 
      {
          leafList.add(root);
      }
  
  
          return();
  }
  </code></pre>