Lines Matching defs:balance
96 * Small arrays to translate between balance (or diff) values and child indeces.
280 * Perform a rotation to restore balance at the subtree given by depth.
290 * On input balance is the "new" balance at "node". This value is either
294 avl_rotation(avl_tree_t *tree, avl_node_t *node, int balance)
296 int left = !(balance < 0); /* when balance = -2, left will be 0 */
298 int left_heavy = balance >> 1;
332 * we detect this situation by noting that child's balance is not
339 * compute new balance of nodes
439 balance = AVL_XBALANCE(gchild);
441 AVL_SETBALANCE(child, (balance == right_heavy ? left_heavy : 0));
446 AVL_SETBALANCE(node, (balance == left_heavy ? right_heavy : 0));
470 * be necessary to maintain an acceptable AVL balance.
520 * Now, back up the tree modifying the balance of all nodes above the
523 * If we brought any subtree into perfect balance (0), we are also done.
531 * Compute the new balance
537 * If we introduced equal balance, then we are done immediately
546 * from -1 to -2 balance, do a rotation.
647 * rotation to fix the balance. This is handled by moving up the tree through
771 * Move up the tree and adjust the balance
783 * If a node was in perfect balance but isn't anymore then
793 * If the new balance is zero, we don't need to rotate
795 * need a rotation to fix the balance.
1033 * child on the right (when balance == +1).