title: better way to find depth of a node in tree
body: <p>I want  to compute depth of a tree
  I have written code below</p>
  
  <p>My question is that : </p>
  
  <ol>
  <li>what is the order of this code? Is it O(n) [n is number of tree Nodes]</li>
  <li>Is there any other way which you think is better and faster?</li>
  </ol>
  
  <p>Thanks in advance</p>
  
  <pre><code>public int height(Node n)
  {
      if(n == null)
          return 0;
      return 1 + Math.max(height(n.left), height(n.right));
  
  }
  </code></pre>