-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.h
executable file
·47 lines (40 loc) · 909 Bytes
/
structs.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdbool.h>
#define MAX_CODE_LENGTH 50
typedef struct fnode
{
char symbol;
float prob;
struct fnode *father;
struct fnode *left;
struct fnode *right;
}FNODE;
typedef struct fnode *FNODEPTR;
typedef struct qnode
{
struct fnode *fnptr;
struct qnode *next;
}QNODE;
typedef struct qnode *QNODEPTR;
typedef struct queue
{
struct qnode *front;
struct qnode *rear;
}QUEUE;
extern char *cbook[257];
extern FNODE *root;
extern int sym_range;
extern struct queue q1;
//Essential functions
void codebook(FNODE *fath,QNODE *l,QNODE *r,int pre);
bool getSym();
bool encInput();
bool decoded();
//Helper Functions
float mod(float );
float sqr(float );
FNODE *makefnode(float pr,char ch);
QNODE *findMin(QNODE *l,QNODE *r);
void saveWord(int pre,FNODE *rt);
void clrmem();
void clrqueue(QNODEPTR t);
void clrTree(FNODEPTR r);