Lines Matching defs:balance
97 * Small arrays to translate between balance (or diff) values and child indeces.
277 * Perform a rotation to restore balance at the subtree given by depth.
287 * On input balance is the "new" balance at "node". This value is either
291 avl_rotation(avl_tree_t *tree, avl_node_t *node, int balance)
293 int left = !(balance < 0); /* when balance = -2, left will be 0 */
295 int left_heavy = balance >> 1;
329 * we detect this situation by noting that child's balance is not
336 * compute new balance of nodes
436 balance = AVL_XBALANCE(gchild);
438 AVL_SETBALANCE(child, (balance == right_heavy ? left_heavy : 0));
443 AVL_SETBALANCE(node, (balance == left_heavy ? right_heavy : 0));
467 * be necessary to maintain an acceptable AVL balance.
505 * Now, back up the tree modifying the balance of all nodes above the
508 * If we brought any subtree into perfect balance (0), we are also done.
516 * Compute the new balance
522 * If we introduced equal balance, then we are done immediately
531 * from -1 to -2 balance, do a rotation.
657 * rotation to fix the balance. This is handled by moving up the tree through
773 * Move up the tree and adjust the balance
785 * If a node was in perfect balance but isn't anymore then
795 * If the new balance is zero, we don't need to rotate
797 * need a rotation to fix the balance.
1008 * child on the right (when balance == +1).