Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int height(BSTNode<T> t) {
- if(t == null){
- return 0;
- }else{
- if ((t.left == null)&&(t.right == null)){
- return 1;
- }else{
- return 1 +(Math.max(height(t.left),height(t.right)));
- }
- }
- }
- public int height() {
- return height(this.root);
- }
Add Comment
Please, Sign In to add comment