#include <stdio.h>
#include <malloc.h>
#include <conio.h>
char Value[100]={0};
int count=0;
typedef struct _BiNode{
struct _BiNode *L;
char Data;
struct _BiNode *R;
}BiNode;
typedef struct _QuNode{
BiNode * Data;
struct _QuNode *Next;
}QuNode;
typedef struct _Queque{
QuNode *Front;
QuNode *Rear;
int Len;
}Queque;
void InitQue(Queque *Que);
void EnQue(Queque *Que,BiNode * c);
BiNode * OutQue(Queque *Que);
int QuEmpty(Queque *Que);
void InitBiTree(BiNode **Hold);
void CreateBiTree(BiNode **Hold);
void GetValue(FILE *fp);
int main( )
{
BiNode *Head,*tmpNode;
FILE * fp_r;
Queque q;
InitQue(&q);
fp_r =fopen("d:\\1.txt","r");
GetValue(fp_r);
fclose(fp_r);
InitBiTree(&Head);
CreateBiTree(&Head);
EnQue(&q,Head);
while(!QuEmpty(&q))
{
tmpNode=OutQue(&q);
printf("%c",tmpNode->Data);
if(tmpNode->L != NULL)
EnQue(&q,tmpNode->L
二叉树------从文件中读取进行层次遍历二叉树(链表)
最新推荐文章于 2022-10-10 20:25:05 发布