Lines Matching refs:balance
281 * Perform a rotation to restore balance at the subtree given by depth.
291 * On input balance is the "new" balance at "node". This value is either
295 avl_rotation(avl_tree_t *tree, avl_node_t *node, int balance)
297 int left = !(balance < 0); /* when balance = -2, left will be 0 */
299 int left_heavy = balance >> 1;
332 * we detect this situation by noting that child's balance is not
338 * 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.
504 * Now, back up the tree modifying the balance of all nodes above the
507 * If we brought any subtree into perfect balance (0), we are also done.
515 * Compute the new balance
521 * If we introduced equal balance, then we are done immediately
530 * from -1 to -2 balance, do a rotation.
647 * rotation to fix the balance. This is handled by moving up the tree through
761 * Move up the tree and adjust the balance
773 * If a node was in perfect balance but isn't anymore then
783 * If the new balance is zero, we don't need to rotate
785 * need a rotation to fix the balance.
1011 * child on the right (when balance == +1).