void BinarySearchTree<T>::swapChildren(Node<T> *curNode) {
  if(curNode) {
    swapChildren(curNode->getLeft());
    swapChildren(curNode->getRight());
    Node<T> *tmp = curNode->getLeft();
    curNode->setLeft(curNode->getRight());
    curNode->setRight(tmp);
  }
}
示例#2
0
LeftistNode< Comparable > * LeftistHeap< Comparable >::mergetree( LeftistNode< Comparable > *h1,
        LeftistNode< Comparable > *h2 )
{
    if(h1->left == NULL)
        h1->left = h2;
    else
    {
        h1->right = merge( h1->right, h2 );
        if( h1->left->npl < h1->right->npl )
            swapChildren( h1 );
        h1->npl = h1->right->npl + 1;
    }
    return h1;
}
示例#3
0
//----------------------------------------------------------------------------//
void GridLayoutContainer::swapChildren(const String& wnd1, Window* wnd2)
{
    swapChildren(getChild(wnd1), wnd2);
}
示例#4
0
//----------------------------------------------------------------------------//
void GridLayoutContainer::swapChildren(Window* wnd1, const String& wnd2)
{
    swapChildren(wnd1, getChild(wnd2));
}
示例#5
0
SkewHeap merge1(SkewHeap H1, SkewHeap H2) {
	H1->Right = merge(H1->Right, H2);
	swapChildren(H1);

	return H1;
}