Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. a) Left Left Case
  2.  
  3. T1, T2, T3 and T4 are subtrees.
  4. z y
  5. / \ / \
  6. y T4 Right Rotate (z) x z
  7. / \ - - - - - - - - -> / \ / \
  8. x T3 T1 T2 T3 T4
  9. / \
  10. T1 T2
  11. b) Left Right Case
  12.  
  13. z z x
  14. / \ / \ / \
  15. y T4 Left Rotate (y) x T4 Right Rotate(z) y z
  16. / \ - - - - - - - - -> / \ - - - - - - - -> / \ / \
  17. T1 x y T3 T1 T2 T3 T4
  18. / \ / \
  19. T2 T3 T1 T2
  20. c) Right Right Case
  21.  
  22. z y
  23. / \ / \
  24. T1 y Left Rotate(z) z x
  25. / \ - - - - - - - -> / \ / \
  26. T2 x T1 T2 T3 T4
  27. / \
  28. T3 T4
  29. d) Right Left Case
  30.  
  31. z z x
  32. / \ / \ / \
  33. T1 y Right Rotate (y) T1 x Left Rotate(z) z y
  34. / \ - - - - - - - - -> / \ - - - - - - - -> / \ / \
  35. x T4 T2 y T1 T2 T3 T4
  36. / \ / \
  37. T2 T3 T3 T4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement