先按先序的顺序输入节点,空的节点以 # 代替,然后以先序遍历,中序遍历,后序遍历,层次遍历的顺序输出。
其中层次遍历中,采用队列的方式缓存节点,如果队列已满则中断遍历,此时输出的结果会不完整,队列大小根据宏 LEN_QUEUE确定。
/*********************************************************************************
* Copyright: (C) 2015 zq979999<zq979999@outlook.com>
* All rights reserved.
*
* Filename: tree.c
* Description: This file
*
* Version: 1.0.0(2015年09月13日)
* Author: zq979999 <zq979999@outlook.com>
* ChangeLog: 1, Release initial version on "2015年09月13日 15时16分08秒"
*
********************************************************************************/
#include <stdio.h>
#include <stdlib.h>
typedef struct _tree
{
char val;
struct _tree *left;
struct _tree *right;
}tree;
tree *tree_creat()
{
char ch;
tr