Guest User

Untitled

a guest
Apr 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. private int height(BSTNode<T> t) {
  2. if(t == null){
  3. return 0;
  4. }else{
  5. if ((t.left == null)&&(t.right == null)){
  6. return 1;
  7. }else{
  8. return 1 +(Math.max(height(t.left),height(t.right)));
  9. }
  10. }
  11.  
  12.  
  13. }
  14.  
  15. public int height() {
  16. return height(this.root);
  17. }
Add Comment
Please, Sign In to add comment