Advertisement
Meruem

cambio valore delle foglie di un albero

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