24.04.2015 Views

Knapsack problem, Huffman Code, Single Source Shortest Path ...

Knapsack problem, Huffman Code, Single Source Shortest Path ...

Knapsack problem, Huffman Code, Single Source Shortest Path ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4: The Greedy Method<br />

We need less than that.<br />

Assume the existence of the five letters ‘a’, ‘b’, ‘c’, ‘d’, ‘e’.<br />

Three bits give us 8 possible different sequences.<br />

letter<br />

code<br />

a 000<br />

b 001<br />

c 010<br />

d 011<br />

e 100<br />

Average code length = 3<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!