Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. int minHeight(node root) {
  2. if(root == null) return 0; //pt cazul nada
  3. if(root.left == null && root.right == null)
  4. return 1;
  5. else {
  6. int l = MAX_VALUE, r = MAX_VALUE;
  7. if(root.left != null)
  8. l = minHeight(root.left);
  9. if(root.right != null)
  10. r = minHeight(root.right);
  11. return 1 + min(l,r);
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement