Guest User

Untitled

a guest
May 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void rbdelete(rbtree *tree, testimone *q){
  2. testimone *r, *s;
  3.  
  4. if(strcmp(q->left->nome, tree->nil->nome)==0 || strcmp(q->right->nome, tree->nil->nome)==0)
  5. r = q;
  6. else
  7. r = treesucc(tree,q);
  8. s = r->left != tree->nil ? r->left : r->right;
  9. s->father = r->father;
  10. if(strcmp(r->father->nome ,tree->nil->nome)==0)
  11. tree->root = s;
  12. else
  13. if(strcmp(r->nome, r->father->left->nome)==0)
  14. r->father->left = s;
  15. else
  16. r->father->right = s;
  17. if(strcmp(r->nome, q->nome) != 0)
  18. strcpy(q->nome, r->nome);
  19. if(r->c == black)
  20. fixup(tree, s);
  21. free(r);
  22. }
Add Comment
Please, Sign In to add comment