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
Pythonfolder. - Open
Huffman.py. - Modify
symbolsandvaluesto match your data. - Run
Huffman.pyto generate Huffman codes.
- Go to the
Matlabfolder. - Run
MainHuffman.min MATLAB. - Modify
symbolsandvaluesto match your data. - Run
MainHuffman.mto 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.pyMatlab:Node.m,buildHuffmanTree.m,printNodes.m,MainHuffman.m
Example data is provided in the scripts. Replace it with your data.