二叉树的镜像

/* 19:> 二叉树的镜像 */
void MirrorTree(BinTree*& pNode)
{
    if (pNode == NULL)
        return;
    if (pNode->m_pLeft == NULL && pNode->m_pRight == NULL)
        return;

    BinTree* pTmp=pNode->m_pLeft;
    pNode->m_pLeft = pNode->m_pRight;
    pNode->m_pRight = pTmp;

    if (pNode->m_pLeft)
        MirrorTree(pNode->m_pLeft);
    if (pNode->m_pRight)
        MirrorTree(pNode->m_pRight);
}

你可能感兴趣的:(二叉树的镜像)