Add huffman tree utility
This commit is contained in:
parent
fa7045bf1c
commit
b4e1f7df8c
3 changed files with 125 additions and 0 deletions
25
libmineziper/include/libmineziper_huffman_tree.h
Normal file
25
libmineziper/include/libmineziper_huffman_tree.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef LIBMINEZIPER_HUFFMAN_TREE_H
|
||||
#define LIBMINEZIPER_HUFFMAN_TREE_H
|
||||
|
||||
#include "libmineziper_bitstream.h"
|
||||
|
||||
typedef struct leaf
|
||||
{
|
||||
int code;
|
||||
short litteral;
|
||||
char length;
|
||||
} leaf;
|
||||
|
||||
typedef struct tree
|
||||
{
|
||||
leaf* leaves;
|
||||
unsigned int size;
|
||||
unsigned int min, max;
|
||||
} tree;
|
||||
|
||||
unsigned int* sort(unsigned char* ints, int size);
|
||||
void print_huffman_tree(tree t);
|
||||
tree build_tree(char* bit_lengths, int size);
|
||||
tree build_default_tree();
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue