title: Are my recursion conditions right to compute binary tree height?
body: <p>I'm trying to know whether my code is right or wrong with your help, because sadly I can't run it to check.</p>
  
  <p>There are no compile errors.  What I'm trying to do is to find the <strong>height of a binary tree</strong>. The tree does not have to be balanced, of course.</p>
  
  <p><a href="http://en.wikipedia.org/wiki/Binary_tree" rel="nofollow">Each node in Binary tree can have two nodes as children</a></p>
  
  <pre><code>public int height(RBNode t) {
    if (t == null)
    return 0;
  
    int heightLeft = height(t.left);
    int heightRight = height(t.right);
  
    if (heightLeft &gt; heightRight) {
      return heightLeft + 1;
    } else {
      return (heightRight + 1);
    }
  }
  </code></pre>
  
  <p>Do you think the recursion conditions are right? My friend claims that it will always return 0.</p>