Category : C Source Code
Archive   : LLIST102.ZIP
Filename : TREE.H

Output of file : TREE.H contained in archive : LLIST102.ZIP


tree.h -- tree function header file


#define BOOLEAN int
#define TRUE 1
#define FALSE 0

#define MALLOC(x) ((x *) malloc(sizeof(x)))
#define CALLOC(n,x) ((x *) calloc(n,sizeof(x)))

* the calling program must declare a structure of type "T_DATA"
* that serves as the data for each node of the tree. Note also
* that the traversal functions (preorder, inorder, postorder)
* expect to be passed a pointer to a function that will be
* executed each pass through the ordering function.

struct NODE
{ struct T_DATA *N_DATA;
struct NODE *L_CHILD;
struct NODE *R_CHILD;
struct NODE *PARENT;
typedef struct NODE NODE_T;

#ifndef NARGS
extern char *malloc(unsigned);
extern char *calloc(unsigned,unsigned);
extern NODE_T *inst_node(struct T_DATA *,NODE_T *);
extern NODE_T *inst_tree(struct T_DATA *);
extern int add_child(NODE_T *, struct T_DATA *);
extern int adopt(NODE_T *, NODE_T *);
extern NODE_T *find_root(NODE_T *);
BOOLEAN is_leaf(NODE_T *);
BOOLEAN is_root(NODE_T *);
void preorder(NODE_T *, void (*)(NODE_T *));
void inorder(NODE_T *, void (*)(NODE_T *));
void postorder(NODE_T *, void (*)(NODE_T *));
extern char *malloc();
extern char *calloc();
extern NODE_T *inst_node();
extern NODE_T *inst_tree();
extern int add_child();
extern int adopt();
extern NODE_T *find_root();
BOOLEAN is_leaf();
BOOLEAN is_root();
void preorder();
void inorder();
void postorder();

  3 Responses to “Category : C Source Code
Archive   : LLIST102.ZIP
Filename : TREE.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: