This repository contains Python and MATLAB implementations of Huffman coding, a data compression algorithm.
Python
: Python code for Huffman coding.Matlab
: MATLAB code for Huffman coding.
- Go to the
Python
folder. - Open
Huffman.py
. - Modify
symbols
andvalues
to match your data. - Run
Huffman.py
to generate Huffman codes.
- Go to the
Matlab
folder. - Run
MainHuffman.m
in MATLAB. - Modify
symbols
andvalues
to match your data. - Run
MainHuffman.m
to generate Huffman codes.
- The code generates Huffman codes for a given set of symbols and their probabilities.
- It calculates and displays Huffman codes for the given set of symbols using the generated Huffman codes.
Python
:Huffman.py
Matlab
:Node.m
,buildHuffmanTree.m
,printNodes.m
,MainHuffman.m
Example data is provided in the scripts. Replace it with your data.