二叉树头文件
![]()
1 //@ author 成鹏致远
2 //@ net http://infodown.tap.cn
3 //@ qq 552158509
4 //@ blog lcw.cnblogs.com
5
6 #ifndef __BINTREE_H
7 #define __BINTREE_H
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <stdbool.h>
12
13
14 typedef char datatype_tree;
15
16 typedef struct tree
17 {
18 datatype_tree data_t;
19 struct tree *lchild,*rchild;
20 }bin_tree,*bin_ptree;
21
22 extern void bintree_create(bin_ptree *ptree);//create a binary tree
23 extern void pre_order(bin_ptree ptree);//iterate voer a binary tree,begin with root
24 extern void in_order(bin_ptree ptree);//iterate over a binary tree,begin with left child
25 extern void post_order(bin_ptree proot);//iterate over a binary tree,begin with right child
26 extern void level_order(bin_ptree proot);
27 extern void travel(char *str, void(*pfun)(bin_ptree),bin_ptree proot);
28
29 #endif
View Code