https://github.com/ryansakurai/huffman-coding
Project that turns text into code using Huffman Coding, based on an Advanced Data Structures exercise.
https://github.com/ryansakurai/huffman-coding
compression data-structures java
Last synced: 5 months ago
JSON representation
Project that turns text into code using Huffman Coding, based on an Advanced Data Structures exercise.
- Host: GitHub
- URL: https://github.com/ryansakurai/huffman-coding
- Owner: ryansakurai
- License: mit
- Created: 2022-10-09T19:26:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-17T20:57:23.000Z (over 1 year ago)
- Last Synced: 2024-11-17T21:35:41.666Z (over 1 year ago)
- Topics: compression, data-structures, java
- Language: Java
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🌳 Huffman Coding 🌳
Huffman Coding is a technique commonly used for lossless data compression. It consists in atributing smaller codes to characters that appear more frequently in a text and bigger ones to characters that appear less frequently, which means it uses variable-lenght codes. It also uses prefix codes, so the fact that no code is the prefix of another code assures there's no ambiguity when decoding data.
This program reads a text until EOF, generates the Huffman Tree, using an auxiliar priority queue (Heap), and prints the frequency and Huffman Coding code of all characters used in it (both the heap and the Huffman tree are implemented). After that, it informs the size of the text using Huffman Coding compared to the size using regular Java encoding (UTF-16).
To produce EOF in Windows Powershell, press CTRL+Z and then enter (you have to press enter before EOF too for it to work, I don't really know why).
