Algorithms

Spring 2007
course
navigation

april 5

b --1---c / \ / \ 5 3 4 6 / \ / \ a--6----d--2----e

huffman notes

To actually implement a 'real' huffman algorithm, you need to be able to
Bit operations in C :
& bitwise AND | bitwise OR ^ XOR ~ One's complement << left shift >> right shift
Note that && and || are logical (not bit) operators; they operate on booleans.
See the bit_ops.c file (attached) for examples.
As for the symbol table, there are many choices as to how to write that; the point is only that the encoded information must include that table somewhere. For very short things to encode, the size of that "header" information may be large enough that the encoded information may actually be larger than the original data ... which kind of defeats the purpose, eh?

other topics

http://cs.marlboro.edu/ courses/ spring2007/algorithms/ notes/ april_5
last modified Thursday April 5 2007 12:46 am EDT

attachments [paper clip]

     name last modified size
[COD]bit_count.c Apr 4 2007 11:49 pm 551B    bit_ops Apr 5 2007 12:25 am 8.06kB [COD]bit_ops.c Apr 5 2007 12:24 am 2.62kB [DOC]duke_cs2_huffman_assignment.pdf Apr 4 2007 10:55 pm 268kB [DIR]huffman/ May 2 2007 9:23 am -    huffman-1.0a.tar.gz Apr 4 2007 10:55 pm 10.3kB