summaryrefslogtreecommitdiff
path: root/c/dataStructure//btree.h
blob: d9507452e8e35927b49c3040509cc568379eb555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef _BTREE_H
#define _BTREE_H

#include<stdio.h>
#include<stdbool.h>
#include<stdlib.h>

typedef char ElemType;
typedef struct node {
    ElemType e;
    struct node * left;
    struct node * right;
} Node;

typedef struct tree {
    Node * root;
    int size;
} Tree;

void InitTree  (Tree * ptree);
bool EmptyTree (const Tree * ptree);
int  CountItem (const Tree * ptree);
bool AddItem   (const ElemType e, Tree * ptree);
bool ResTree   (Node * pnode);
void PrintTree (const Node * root);

#endif