
































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!

































Antenati che hanno
x in sottoalbero sx
Tree-Insert(T,z)
1 y ← NIL
2 x ← root[T]
3 while x ≠ NIL
4 do y ← x
5 if key[z]<key[x]
6 then x ← left[x]
7 else x ← right[x]
8 p[z] ← y
9 if y=NIL
10 then root[T] ← z
11 else if key[z] < key[y]
12 then left[y] ← z
13 else right[y] ← z
Tree-Insert(T,z)
1 y ← NIL
2 x ← root[T]
3 while x ≠ NIL
4 do y ← x
5 if key[z]<key[x]
6 then x ← left[x]
7 else x ← right[x]
8 p[z] ← y
9 if y=NIL
10 then root[T] ← z
11 else if key[z] < key[y]
12 then left[y] ← z
13 else right[y] ← z