-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBiTree.h
31 lines (30 loc) · 947 Bytes
/
BiTree.h
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
28
29
30
31
#ifndef BITREE_H
#define BITREE_H
#include "statis.h"
struct BiTree
{
char c1;
char c2;
long freq;
struct BiTree *leftTree;
struct BiTree *rightTree;
struct BiTree *parent;
};
typedef struct BiTree BiTree;
BiTree *bt_Create(char c1, char c2, long freq);
BiTree *bt_GetParent(BiTree *biTree);
BiTree *bt_GetLeftTree(BiTree *biTree);
BiTree *bt_GetRightTree(BiTree *biTree);
int bt_SetLeft(BiTree *biTree, BiTree *value);
int bt_SetRight(BiTree *biTree, BiTree *value);
BiTree *bt_NewRight(BiTree *biTree, char c1, char c2, long freq);
BiTree *bt_NewLeft(BiTree *biTree, char c1, char c2, long freq);
void bt_PreOrder(BiTree *biTree);
void bt_PreOrderRight(BiTree *biTree);
void bt_PreOrderLeft(BiTree *biTree);
int bt_SetParent( BiTree *target,BiTree *dad);
BiTree *bt_CreHuff(FreLinkList *linkList);
void bt_PrintPreOrder(BiTree *biTree);
void bt_HuffCode(BiTree *huffTree,FreLinkList *frelinklist);
int bt_LeaveCount(BiTree *tree);
#endif