填空题
下列代码的功能是将二叉树T中的结点按照层序遍历的顺序输出。
typedef struct TreeNode* Tree;
struct TreeNode
{
int Key;
Tree Left;
Tree Right;
};
void Level_order(Tree T)
{
Queue Q;
if (!T) return;
Q = CreateQueue(MaxElements);
Enqueue(T, Q);
while (!IsEmpty(Q)) {
T = Front_Dequeue(Q); /* return the front element and delete it from Q */
printf("%d ", T->Key);
if (T->Left)
EnQueue(Q, T->Left);
if (T->Right)
EnQueue(Q, T->Right);
}
}