title: Recursion Getting count of numbers that reside in AVL Tree
body: <pre><code>  public int count(Vertex T, int start, int end, int count) {
  
        if (T == null) {
            return -1;
        }
  
        count(T.left,start,end,count);
        int test=T.key;
        if(test &gt;=start &amp;&amp; testKey&lt;end){
            count++;
        }
  
        System.out.print(T.key+"#"+count+"# ");                  
        count(T.right,start,end,count);
  
        return count;
     }
  </code></pre>
  
  <p>I am trying to get a count of numbers in a self-written, balancing search tree that is greater than or equal to my Start number and less than my End number.</p>
  
  <p>So far my balancing search tree is correct, the only issue I have now is to correctly return the count. I have checked with the code above that it is counting correctly for numbers that matches my range however the issue I am having now is that I am unable to return the count I needed as it will return to 0 because of the nature of the recursive function call.</p>
  
  <p>It would be helpful if I could get suggestions to return the desired count.</p>