二叉树结构是否相同
bool strcutcmp(BiTNode *pRoot1,BiTNode *pRoot2)
{
if (pRoot1 == NULL && pRoot2 == NULL)
{
return true;
}
if (pRoot1 == NULL || pRoot2 ==NULL)
{
return false;
}
bool left = strcutcmp(pRoot1->lchild,pRoot2->lchild);
bool right = strcutcmp(pRoot1->rchild,pRoot2->rchild);
return left && right;
}
一切源于对计算机的热爱

浙公网安备 33010602011771号