Ejemplo n.º 1
0
Archivo: avl.c Proyecto: Emeraude/AVL
void avl_remove(t_avl *const avl, void *const val) {
  if (!avl->hook_cmp) {
    fprintf(stderr, "%s: Warning: no cmp hook defined. Using default comparators.\n", __FUNCTION__);
    avl->hook_cmp = __default_hook_cmp;
  }
  __remove(avl, (t_node **)&avl->root, val);
}
Ejemplo n.º 2
0
Archivo: avl.c Proyecto: Emeraude/AVL
/* deletion */
static void __remove(t_avl const *const avl, t_node **const root, void *val) {
  if (*root == nil)
    return;
  if (!avl->hook_cmp((*root)->val, val)) {
    if ((*root = rotate(avl, root, BALANCE(*root) < 0)) == nil)
      return;
  }
  __remove(avl, &(*root)->node[avl->hook_cmp(val, (*root)->val) < 0], val);
  balance(avl, root);
}
Ejemplo n.º 3
0
treap_head * treap_remove(treap_tree *tree, treap_head *node)
{
   treap_head **pp;
   assert(tree && node);

   if (!tree || !node)
      return node;

   if (!node->parent)
      if (tree->root == node)
         pp = &tree->root;
      else
         return node;
   else {
      if (node->parent->left == node)
         pp = &node->parent->left;
      else if (node->parent->right == node)
         pp = &node->parent->right;
      else
         return node;
   }
   __remove(pp);
   return node;
}
Ejemplo n.º 4
0
		void GuiContainerAPI::__remove_unsafe(GuiElementAPI* element)
		{
			__remove(GuiElementPtr(element, EmptyElementDeleter));
		}