Skip to content

Instantly share code, notes, and snippets.

View ixfd64's full-sized avatar

Danny Chia ixfd64

View GitHub Profile
@ixfd64
ixfd64 / ECE253_hw6_prob10.py
Last active March 14, 2026 23:10
Python script to compute Huffman and Shannon-Fano-Elias codes, created as part of an assignment for ECE 253 at UC Santa Cruz
# A program that accepts a given text and generates its Huffman code and
# Shannon–Fano–Elias code, as well as additional information.
#
# Created as part of an assignment for ECE 253 at UC Santa Cruz.
import heapq
import math
import textwrap
from collections import Counter