Esempio n. 1
0
File: avl.c Progetto: 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);
}
Esempio n. 2
0
File: avl.c Progetto: 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);
}
Esempio 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;
}
		void GuiContainerAPI::__remove_unsafe(GuiElementAPI* element)
		{
			__remove(GuiElementPtr(element, EmptyElementDeleter));
		}