Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Algo(T,k1,k2)
  2. P = NIL
  3. Z = T
  4. Y,X;
  5. while (z!= NIL) do
  6. P=Z
  7. If Z->key < k1 then
  8. Z=Z->dx
  9. If Z->key > k2 then
  10. Z=Z->sx
  11. else
  12. If (Z->sx == NIL OR Z->dx == NIL) Then
  13. Y=Z
  14. else
  15. Y=Z->dx; P=Z
  16. while(Y->sx != NIL) DO
  17. P=Y
  18. Y=Y->sx
  19. If (Y->sx != NIL) then
  20. X=Y->sx
  21. else
  22. X=Y->dx
  23. If (P=NIL) then
  24. T=X
  25. else if (Y=P->SX) then
  26. P->sx = X
  27. else
  28. P->dx = X
  29. If (Y!=Z) Then
  30. "copia i campi di y in z"
  31. "dealloca Y"
  32. return T
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement