Bunch of my homework assignments on ETF, Sarajevo
Licensed under: CRAPL http://matt.might.net/articles/crapl/ :))
MMS\shannon_fano_coding.py - Shannon-Fano coding done in Python.
Usage:
coding_schema = ShannonFanoCoding.getCodingSchema("Hello")
coding_schema will now contain following list of tuples: [('l', 2, '0'), ('H', 1, '10'), ('e', 1, '110'), ('o', 1, '111')] Tuples consists of following elements: character, number of occurences, coding string
MMS\huffman_coding.py - Huffman coding done in Python.
Usage:
coding_schema = HuffmanCoding.getCodingSchema("Hello")
coding_schema will now contain following list of tuples: [('l', 2, '0'), ('o', 1, '10'), ('H', 1, '110'), ('e', 1, '111')] Tuples consists of following elements: character, number of occurences, coding string