Skip to content

nrutkowski1/HuffmanEncoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HuffmanEncoding

Compress and decompress a file using the Huffman encoding technique

Begin by initializing a new Huffman object by h = Huffman()

Building the Tree

To build the tree call h.building_tree("your input") "your input" must be a string. A binary tree will then be built from the input string using the Huffman encoding technique

Viewing the Tree

after building the tree it can be viewed by calling h.view_tree(h.get_data())

Encoding

To encode a file and compress it call h.encode('file to encode', 'output file') The 'file to encode' should be a document containing text. The 'output file' should be a binary file. An example input would be 'output.bin'

Decoding

To decode and decompress the file call h.decode('file to decode', 'output file') The 'file to decode' should be a compressed binary file such as previously mentioned 'output.bin' The output file should now be a text document an example being 'output.txt'

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy