Skip to content

Abdallah-Elshamy/huffman-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

huffman-codes

An implementation for Huffman codes Algorithm

In this programming problem and the next you'll code up the greedy algorithm from the lectures on Huffman coding.

This file "huffman.txt" describes an instance of the problem. It has the following format:

[number_of_symbols]

[weight of symbol #1]

[weight of symbol #2]

...

For example, the third line of the file is "6852892," indicating that the weight of the second symbol of the alphabet is 6852892. (We're using weights instead of frequencies, like in the "A More Complex Example" video.)

Your task in this problem is to run the Huffman coding algorithm from lecture on this data set. What is the maximum and the minimum length of a codeword in the resulting Huffman code?