Advertisement
Meruem

altezza albero

Jun 14th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function t_height(t)
  2. {
  3.     var cur,n=0,hl,hr;
  4.     if(t.root==null){return 0;}
  5.     cur=t.root; if(cur.left!=null && cur.right!=null)
  6.     {n++;}
  7.        else {return n;}
  8.     hl=t_height(t.left);
  9.     h2=t_height(t.right);
  10.     if(hl>hr){return hl;}
  11.     else{return hr;}
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement