-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtreeQueue.h
62 lines (49 loc) · 1.5 KB
/
treeQueue.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef HUFFMAN_TREEQUEUE_H
#define HUFFMAN_TREEQUEUE_H
#include <stdio.h>
typedef struct treeQueue treeQueue;
/*
* Creates a new node, sets its byte and frequency as the both passed byte and frequency. And returns it.
*/
treeQueue *treeQueue_createNode(unsigned char, long long int);
/*
* Creates a new node, sets its byte, frequency and childs as the both passed byte, frequency and childs. And returns it.
*/
treeQueue *treeQueue_createWildCardNode(unsigned char, long long int, treeQueue*, treeQueue*);
/*
* Enqueues the passed byte with its frequency in the passed treeQueue.
*/
void treeQueue_enqueue(treeQueue**, unsigned char, long long int);
/*
* Prints in the file FILE* the treeQueue in preorder format.
*/
void treeQueue_printTreePreorder(treeQueue*, FILE*);
/*
* Transforms the queue of the passed treeQueue into a tree.
*/
void treeQueue_formTree(treeQueue**);
/*
* Returns the left child of the passed treeQueue.
*/
treeQueue *treeQueue_getLeft(treeQueue*);
/*
* Returns the right child of the passed treeQueue.
*/
treeQueue *treeQueue_getRight(treeQueue*);
/*
* Returns the byte stored in the passed treeQueue node.
*/
unsigned char treeQueue_getByte(treeQueue*);
/*
* Returns 1 if the passed treeQueue node is a leaf node and returns 0 otherwise.
*/
int treeQueue_isLeafNode(treeQueue*);
/*
* Sorts the queue of the passed treeQueue.
*/
void treeQueue_sort(treeQueue**);
/*
* Returns the length of the printed preorder treeQueue.
*/
int getHeightTree();
#endif //HUFFMAN_TREEQUEUE_H