PTA 二叉树的层次遍历
6-6 二叉树的层次遍历 (6 分) 本题要求实现给定的二叉树的层次遍历。 函数接口定义: void Levelorder(BiTree T); T是二叉树树根指针,Levelorder函数输出给定二叉树的层次遍历序列,格式为一个空格跟着一个字符。 其中BinTree结构定义如下: typedef char ElemType; typedef struct BiTNode { ElemType data; struct BiTNode *lchild, *rchild; }BiTNode, *BiTree; 裁判测试程序样例: #include <stdio.h> #include <stdlib.h> typedef char ElemType; typedef struct BiTNode { ElemType data; struct BiTNode *lchild, *rchild; }BiTNode, *BiTree; BiTree Create();/* 细节在此不表 */ void Levelorder(BiTree T); int main() { BiTree T = Create(); printf("Levelorder:"); Levelorder(T); printf("\n"); return 0; } /* 你的代码将被嵌在这里 */ 输出样例