文章目录
1.题目描述
2.ac答案
c++
void LevelTraverse(BiTNode* T)
{
queue<struct BiTNode*> q;
if (T != nullptr)
{
q.push(T);
}
while (!q.empty())
{
BiTNode* front = q.front();
cout << front->data;
q.pop();
if (front->lchild)
q.push(front->lchild);
if (front->rchild)
q.push(front->rchild);
}
cout << endl;
}