Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tree_insert(t,o,chiave)
- {
- var n={dato:o,left:null,right:null};
- var cur=t.root;
- if(t.root==null)
- {
- t.root=n;
- return;
- }
- while(true)
- {
- if(o[chiave]<= cur.dato[chiave])
- {
- if(cur.left==null)
- {
- cur.left=n;
- return;
- }else
- {
- cur=cur.left;
- }
- }else
- {
- if(cur.right==null)
- {
- cur.rigth=n;
- return;
- }else
- { cur=cur.right;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement