huffman

# huffman - CSC316(Material from M Scott U Texas Austin Topic...

This preview shows pages 1–9. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSC316 (Material from M. Scott @ U Texas Austin) Topic 19 Applications of Binary Trees: Huffman Coding The author should gaze at Noah, and ... learn, as they did in the Ark, to crowd a great deal of matter into a very small compass. Sydney Smith, Edinburgh Review CSC316 (Material from M. Scott @ U Texas Austin) Encoding and Compression of Data • Fax Machines • Graphic files • ASCII • Variations on ASCII – min number of bits needed – cost of savings – patterns – modifications CSC316 (Material from M. Scott @ U Texas Austin) Purpose of Huffman Coding • Proposed by Dr. David A. Huffman – A Method for the Construction of Minimum Redundancy Codes – Written in 1952 • Applicable to many forms of data transmission – Our example: text files CSC316 (Material from M. Scott @ U Texas Austin) The Basic Algorithm • Huffman coding is a form of statistical coding • Not all characters occur with the same frequency! • Yet all characters are allocated the same amount of space – 1 char = 1 byte, be it e or x CSC316 (Material from M. Scott @ U Texas Austin) The Basic Algorithm • Any savings in tailoring codes to frequency of character? • Code word lengths are no longer fixed like ASCII or Unicode • Code word lengths vary and will be shorter for the more frequently used characters CSC316 (Material from M. Scott @ U Texas Austin) The (Real) Basic Algorithm 1. Scan text to be compressed and tally occurrence of all characters. 2. Sort or prioritize characters based on number of occurrences in text. 3. Build Huffman code tree based on prioritized list. 4. Perform a traversal of tree to determine all code words. 5. Scan text again and create new file using the Huffman codes CSC316 (Material from M. Scott @ U Texas Austin) Building a Tree Scan the original text • Consider the following short text Eerie eyes seen near lake. • Count up the occurrences of all characters in the text CSC316 (Material from M. Scott @ U Texas Austin) Building a Tree Scan the original text Eerie eyes seen near lake....
View Full Document

## This note was uploaded on 03/24/2008 for the course CSC 316 taught by Professor Rhee during the Spring '08 term at N.C. State.

### Page1 / 44

huffman - CSC316(Material from M Scott U Texas Austin Topic...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online