Пример #1
0
/**
* Double rotate binary tree node: first right child.
* with its left child; then node k1 with new right child.
* For AVL trees, this is a double rotation for case 3.
* Update heights, then set new root.
*/
void AvlTree::doubleWithRightChild( AvlNode * & k1 ) const {
    rotateWithLeftChild( k1->right );
    rotateWithRightChild( k1 );
}
Пример #2
0
/*
 *    Double rotate binary tree: first left child
 *       with its right child; then node k3 with new left child.
 *          Update heights, then set new root.
 *          */
void doubleWithLeftChild( AvlNode * & k3 )
{
   rotateWithRightChild( k3->left );
   rotateWithLeftChild( k3 );
}
Пример #3
0
/**
* Double rotate binary tree node: first left child.
* with its right child; then node k3 with new left child.
* For AVL trees, this is a double rotation for case 2.
* Update heights, then set new root.
*/
void AvlTree::doubleWithLeftChild( AvlNode * & k3 ) const {
    rotateWithRightChild( k3->left );
    rotateWithLeftChild( k3 );
}