Advertisement
gracefu

Untitled

Oct 10th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. if (left == NULL) {
  2. if (right == NULL) {
  3. if (node == t->root) {
  4. t->root = NULL;
  5. } else {
  6. Node parent = node->parent;
  7. if (parent->left == node) {
  8. parent->left = NULL;
  9. Tree_DeleteBalance (t, parent, 1);
  10. } else {
  11. parent->right = NULL;
  12. Tree_DeleteBalance (t, parent, -1);
  13. }
  14. }
  15. } else {
  16. Tree_Replace (node, right);
  17. Tree_DeleteBalance (t, node, 0);
  18. toDelete = right;
  19. }
  20. } else if (right == NULL) {
  21. Tree_Replace (node, left);
  22. Tree_DeleteBalance (t, node, 0);
  23. toDelete = left;
  24. } else {
  25. Node successor = right;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement