Skip to content

Instantly share code, notes, and snippets.

@arjunrao87
Created December 21, 2014 23:50
Show Gist options
  • Save arjunrao87/05693b687f6bad922b71 to your computer and use it in GitHub Desktop.
Save arjunrao87/05693b687f6bad922b71 to your computer and use it in GitHub Desktop.
Height of a BST
public int height( Node root ){
if( root == null ){
return 0;
}
int heightLeft = height( root.getLeftChild() );
int heightRight = height( root.getRightChild() );
return Math.max( heightLeft, heightRight ) + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment