Skip to content

Instantly share code, notes, and snippets.

@bhrigu123
bhrigu123 / HuffmanCoding.py
Last active December 31, 2019 11:08
Code for Huffman Coding, compression and decompression. Explanation at http://bhrigu.me/blog/2017/01/17/huffman-coding-python-implementation/
import heapq
import os
class HeapNode:
def __init__(self, char, freq):
self.char = char
self.freq = freq
self.left = None
self.right = None