Algorithms

Spring 2011
course
navigation

March 28

news

midterm projects

Finish this week; next assignment due a week from today (will be posted by Thu).

review

Open discussion of what we've done so far.

possible next topics

taste of compression algorithms : Huffman and LZW encoding
a common datastructure : hash / dictionary / (key,value) storage with O(1) lookup. How does that work?
Runge-Kutta type approach to differential equations
"hard" NP problems : approximate answers

Huffman coding

Compression algorithms are all about taking something (a file, a multimedia stream, ...) and making it smaller. There are two big categories: lossless (i.e. don't lose any data) and lossy (i.e. throw away 'unimportant' stuff). Exercise 1: give some examples of each that you use regularly. Exercise 2: how big a factor is the compression? An ideal algorithms has (a) a large compression factor, and (b) runs fast. Typically there is some tradeoff between these two things. And many real applications/protocols use several types of compression sequentially.
Huffman basic idea:
Morse code uses a similar notion: "e" is dot, "z" is "dash dash dot dot".
Huffman (1952) is provably the best way to do this sort of trick; it gives a "prefix code" (or prefix-free code) which doesn't need any special markers between characters, even though they're made of bitstrings of different length(!)
Walk through an example of the code generation algorithm.
This is called "fixed to variable" encoding. Explain.
Resources:
http://cs.marlboro.edu/ courses/ spring2011/algorithms/ notes/ March_28
last modified Tuesday March 29 2011 12:28 am EDT