- This is a simple implementation of Huffman's algorithm, generally used in data compression.
- https://en.wikipedia.org/wiki/Huffman_coding
- In this specific implementation, the correctness of the code generated can be prooved manually by following the workflow of the algorithm, described below:
- A dictionary in Python was used as the primary data structure. In order to deal with all the characters and calculate their frequencies, each character given in the message is added to this dictionary and the values for each key (character) represents its frequency. Due to that, the caracters within the dictionary are automatically sorted in alphabetical order.
- In every step, an auxiliar array is generated with sorted items from the dictionary, but this time they are sorted by the values for each key.
- With that, the first two items are summed in order to get the frequency for a new node, that represents those characters union.
- A