Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int assignHeight(node n)
- {
- if(n == null)
- {
- return -1;
- }
- int hL;
- int hR;
- hL = assignHeight(n.left)+1;
- hR = assignHeight(n.right)+1;
- n.height = Math.max(hL, hR);
- return n.height;
- }
Advertisement
Add Comment
Please, Sign In to add comment