data_compression.huffman¶
Classes¶
Functions¶
| 
 | Run through the list of Letters and build the min heap | 
| 
 | Parse the file, build the tree, then run through the file | 
| 
 | Read the file and build a dict of all letters and their | 
| 
 | Recursively traverse the Huffman Tree to set each | 
Module Contents¶
- class data_compression.huffman.Letter(letter: str, freq: int)¶
- __repr__() str¶
 - bitstring: dict[str, str]¶
 - freq: int¶
 - letter: str¶
 
- class data_compression.huffman.TreeNode(freq: int, left: Letter | TreeNode, right: Letter | TreeNode)¶
- freq: int¶
 
- data_compression.huffman.build_tree(letters: list[Letter]) Letter | TreeNode¶
- Run through the list of Letters and build the min heap for the Huffman Tree. 
- data_compression.huffman.huffman(file_path: str) None¶
- Parse the file, build the tree, then run through the file again, using the letters dictionary to find and print out the bitstring for each letter.