april 5
- Finish discussing heap midterms.
- By hand do Prim and Kruskal for 9.2 a :
b --1---c
/ \ / \
5 3 4 6
/ \ / \
a--6----d--2----e
- Do 9.2 11 : Steiner tree for unit square
huffman notes
To actually implement a 'real' huffman algorithm, you need to be able to
- manipulate bits individually
- save the symbol table (in some format or other) along with the encoded bits
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
- traveling salesman approx greedy algorithm