假设二叉树采用二叉链存储结构存储,试设计一个算法,求中序遍历序列中第一个结点的值。

C或C++

第1个回答  2017-12-01
int count = 0;
void countSingleChild(Btree *T)
{
if(T)
{
if((T->left == NULL && T->right != NULL)||(T->left != NULL && T->right == NULL))
count++;
countSingleChild(T->left);
countSingleChild(T->right);
}
}本回答被网友采纳
相似回答