/*
 * tree.h
 *
 *  Created on: 2010-11-12
 *      Author: Jenson
 */

#ifndef TREE_H_
#define TREE_H_

typedef int item_type;
typedef struct _treenode_ *btree;

#define MAX_SIZE 100
#define MAX_WIDTH 4
struct _treenode_{
    item_type data;
    btree lchild;
    btree rchild;
};

extern btree bt_create( char* str);

extern int bt_height(btree);
extern int bt_leaf_count(btree);
extern int bt_node_count(btree);
extern int bt_copy(btree desc,btree src);

void bt_all_path(btree,item_type[],int);
void bt_level_num(btree,int a[],int h);
extern int bt_width(btree);

extern void bt_traverse(btree);
extern void bt_traverse_l(btree);
extern void bt_pre_order_traverse(btree);
extern void bt_mid_order_traverse(btree);
extern void bt_post_order_traverse(btree);
extern void bt_traverse_by_level(btree);


#endif /* TREE_H_ */