 The amount of data we deal with is getting larger  Not only do larger files require more disk space, they take longer to transmit  Many times files.

Slides:



Advertisements
Similar presentations
CREATING a HUFFMAN CODE EVERY EGG IS GREEN E ///// V/V/ R // Y/Y/ I/I/ S/S/ N/N/ Sp /// V/V/ Y/Y/ I/I/ S/S/ N/N/ R // Sp /// G /// E /////
Advertisements

Lecture 4 (week 2) Source Coding and Compression
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture3.
Huffman Encoding Dr. Bernard Chen Ph.D. University of Central Arkansas.
Greedy Algorithms (Huffman Coding)
Data Compressor---Huffman Encoding and Decoding. Huffman Encoding Compression Typically, in files and messages, Each character requires 1 byte or 8 bits.
Compression & Huffman Codes
Huffman Coding: An Application of Binary Trees and Priority Queues
Optimal Merging Of Runs
CSCI 3 Chapter 1.8 Data Compression. Chapter 1.8 Data Compression  For the purpose of storing or transferring data, it is often helpful to reduce the.
HUFFMAN TREES CSC 172 SPRING 2002 LECTURE 24. Prefix Codes Consider a binary trie representing a code
A Data Compression Algorithm: Huffman Compression
Is ASCII the only way? For computers to do anything (besides sit on a desk and collect dust) they need two things: 1. PROGRAMS 2. DATA A program is a.
6/26/2015 7:13 PMTries1. 6/26/2015 7:13 PMTries2 Outline and Reading Standard tries (§9.2.1) Compressed tries (§9.2.2) Suffix tries (§9.2.3) Huffman encoding.
Data Representation CS105. Data Representation Types of data: – Numbers – Text – Audio – Images & Graphics – Video.
Lossless Data Compression Using run-length and Huffman Compression pages
Data Compression and Huffman Trees (HW 4) Data Structures Fall 2008 Modified by Eugene Weinstein.
Management Information Systems Lection 06 Archiving information CLARK UNIVERSITY College of Professional and Continuing Education (COPACE)
Huffman Codes Message consisting of five characters: a, b, c, d,e
Dale & Lewis Chapter 3 Data Representation
Data Structures and Algorithms Huffman compression: An Application of Binary Trees and Priority Queues.
Chapter 2 Source Coding (part 2)
1 Analysis of Algorithms Chapter - 08 Data Compression.
Lecture Objectives  To learn how to use a Huffman tree to encode characters using fewer bytes than ASCII or Unicode, resulting in smaller files and reduced.
Data Compression By, Keerthi Gundapaneni. Introduction Data Compression is an very effective means to save storage space and network bandwidth. A large.
Image Compression (Chapter 8) CSC 446 Lecturer: Nada ALZaben.
Compression.  Compression ratio: how much is the size reduced?  Symmetric/asymmetric: time difference to compress, decompress?  Lossless; lossy: any.
Huffman Coding and Decoding TAIABUL HAQUE NAEEMUL HASSAN.
ICS 220 – Data Structures and Algorithms Lecture 11 Dr. Ken Cosh.
ALGORITHMS FOR ISNE DR. KENNETH COSH WEEK 13.
Huffman Coding. Huffman codes can be used to compress information –Like WinZip – although WinZip doesn’t use the Huffman algorithm –JPEGs do use Huffman.
COMPRESSION. Compression in General: Why Compress? So Many Bits, So Little Time (Space) CD audio rate: 2 * 2 * 8 * = 1,411,200 bps CD audio storage:
Bits and Huffman Encoding Please get a piece of paper and a pen and put your name and netid on it. Make sure you can turn in it after class without losing.
UTILITIES Group 3 Xin Li Soma Reddy. Data Compression To reduce the size of files stored on disk and to increase the effective rate of transmission by.
Introduction to Algorithms Chapter 16: Greedy Algorithms.
Huffman coding Content 1 Encoding and decoding messages Fixed-length coding Variable-length coding 2 Huffman coding.
Huffman Codes Juan A. Rodriguez CS 326 5/13/2003.
Huffman’s Algorithm 11/02/ Weighted 2-tree A weighted 2-tree T is an extended binary tree with n external nodes and each of the external nodes is.
Chapter 3 Data Representation. 2 Compressing Files.
1 Algorithms CSCI 235, Fall 2015 Lecture 30 More Greedy Algorithms.
Huffman Codes. Overview  Huffman codes: compressing data (savings of 20% to 90%)  Huffman’s greedy algorithm uses a table of the frequencies of occurrence.
Lecture 12 Huffman Algorithm. In computer science and information theory, a Huffman code is a particular type of optimal prefix code that is commonly.
بسم الله الرحمن الرحيم My Project Huffman Code. Introduction Introduction Encoding And Decoding Encoding And Decoding Applications Applications Advantages.
Huffman code and Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
CS 101 – Sept. 11 Review linear vs. non-linear representations. Text representation Compression techniques Image representation –grayscale –File size issues.
Data Compression: Huffman Coding in Weiss (p.389)
3.3 Fundamentals of data representation
Design & Analysis of Algorithm Huffman Coding
Huffman Codes ASCII is a fixed length 7 bit code that uses the same number of bits to define each character regardless of how frequently it occurs. Huffman.
B/B+ Trees 4.7.
Tries 07/28/16 11:04 Text Compression
Assignment 6: Huffman Code Generation
Madivalappagouda Patil
Tries 5/27/2018 3:08 AM Tries Tries.
ISNE101 – Introduction to Information Systems and Network Engineering
Tries 9/14/ :13 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Optimal Merging Of Runs
Data Compression If you’ve ever sent a large file to a friend, you may have compressed it into a zip archive like the one on this slide before doing so.
The Huffman Algorithm We use Huffman algorithm to encode a long message as a long bit string - by assigning a bit string code to each symbol of the alphabet.
Optimal Merging Of Runs
Huffman Coding.
Math 221 Huffman Codes.
Huffman Coding CSE 373 Data Structures.
Huffman Encoding Huffman code is method for the compression for standard text documents. It makes use of a binary tree to develop codes of varying lengths.
Data Structure and Algorithms
Tries 2/23/2019 8:29 AM Tries 2/23/2019 8:29 AM Tries.
File Compression Even though disks have gotten bigger, we are still running short on disk space A common technique is to compress files so that they take.
Data Compression.
Algorithms CSCI 235, Spring 2019 Lecture 30 More Greedy Algorithms
Presentation transcript:

 The amount of data we deal with is getting larger  Not only do larger files require more disk space, they take longer to transmit  Many times files are compressed to save space or for faster transmission

 The simplest type of redundancy in a file is long runs of repeated characters  AAAABBBAABBBBBCCCCCCCC  This string can be represented more compactly by replacing each repeated string with a single occurrence of the character and a count  4A3B2A5B8C  For binary files a refined version of this method can yield dramatic savings

 Suppose we wish to encode  ABRACADABRA  Instead of using the standard 8 (or 16) bits to represent these letters, why not use 3?  A =  B = 001  C = 010  D = 011  R = 100

 Why use the same number of bits for each letter?  A =  B = 1  C = 01  D = 10  R = 11  This is not really a code because it depends on the blanks 

 A slightly different code  A = 1  B = 010  C = 000  D = 001  R = 011  Can you decode this without the blanks? 

 A slightly different code  A = 1  C = 000  D = 001  B = 010  R = 011  Why can you decode without having the blanks?

 A (5) = 1  C (1) = 000  D (1) = 001  B (2) = 010  R (2) = 011  What do you notice about the number of bits used to represent each character? A CDBR 0 1

 The general method for finding this code was developed by D. Huffman in 1952  Huffman coding uses a specific method for choosing the representation for each symbol, resulting in a prefix code  The most common source symbols using shorter strings of bits than are used for less common source symbols  Used in many compression programs

 Start with your text  GO GO TIGERS  Build a frequency table CharacterFrequency G3 O2 2 T1 I1 E1 R1 S1

 Create a tree using two of the characters that appear least often  Merge them in the table  Repeat until everything is merged