A simple compressing application using naive huffman encoding algorithm.
-
First pass:
- Read source content by bytes.
- Count each byte's occurrence. (Hash map)
-
Encode:
- Sort read bytes. (Priority queue)
- Build huffman tree. (Huffman tree)
-
Second pass:
- Replace each byte with generated code.
- Generate encoding informations.