# Multimedia Communications. Huffman Coding

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Multimedia Communications Huffman Coding

2 Optimal codes Suppose that a i -> w i C + is an encoding scheme for a source alphabet A={a 1,, a N }. Suppose that the source letter a 1,, a N occur with relative frequencies f 1,.. f N respectively. The average code word length of the code is defined as: l = N i=1 f i l i where l i is the length of w i The average number of code letters required to encode a source text consisting of N source letters is N l It may be expensive and time consuming to transmit long sequences of code letters, therefore it may be desirable for l to be as small as possible. It is in our power to make l small by cleverly making arrangements when we devise the encoding scheme.

3 Optimal codes What constraints should we observe? The resulting code should be uniquely decodable Considering what we saw in the previous chapter, we confine ourselves to prefix codes. An encoding scheme that minimizes encoding is called optimal The process of finding the optimal code was algorithmized by Huffman. l

4 Optimal codes The necessary conditions for an optimal variable-length binary code are: 1. Given any two letters a j and a k if a ) P( a ) then P l j lk ( j k 2. The two least probable letters have codewords with the same maximum length 3. In the tree corresponding to the optimum code, there must be two branches stemming from each intermediate node 4. Suppose we change an intermediate node into a leaf node by combining all the leaves descending from it into a composite word of a reduced alphabet. Then, if the original tree was optimal for the original alphabet, the reduced tree is optimal for the reduced alphabet.

5 Condition #1 and #2 Condition #1 is obvious Suppose an optimum code C exists in which the two code words corresponding to the least probable symbols do not have the same length. Suppose the longer code word is k bits longer than the shorter one. As C is optimal, the codes corresponding to the least probable symbols are also the longest. As C is a prefix code, none of the code words is a prefix of the longer code.

6 Condition #2 This means that, even if we drop the last k bits of the longest code word, the code words will still satisfy the prefix condition. By dropping the k bits, we obtain a new code that has a shorter average word length. Therefore, C cannot be optimal.

7 Conditions #3 and #4 Condition #3: If there were any intermediate node with only one branch coming from that node, we could remove it without affecting the decipherability of the code while reducing its average length. Condition #4: If this condition were not satisfied, we could find a code with smaller average code length for the reduced alphabet and then simply expand the composite word of a reduced alphabet. Then, if the original tree was optimal for the original alphabet, the reduced tree is optimal for the reduced alphabet

8 Codes generated by Huffman algorithm (explained shortly) meet the above conditions

9 Building a Huffman Code The main idea: Let S be a source with alphabet A={a 1,,a N }ordered according to decreasing probability. Let S' be a source with alphabet A'={a' 1,,a' N-1 } such that P(a' N P(a' k ) = P(a 1 ) = P(a N ) + P(a N 1) k ) 1 k Then if a prefix code is optimum for S', the corresponding prefix code for S is also optimum. We continue this process until we have a source with only two symbols. N 2

10 Building a Huffman Code a 2 (.4) a 2 (.4) a 2 (.4) a'' 3 (.6) 0 a''' 3 (1) a 1 (.2) a 1 (.2) a' 3 (.4) 0 a 2 (.4) 1 a 3 (.2) a 3 (.2) 0 a 1 (.2) 1 a 4 (.1) 0 a' 4 (.2) 1 a 5 (.1) 1 a 2 (.4) 1 a 1 (.2) 01 a 3 (.2) 000 average length = 2.2 bits a 4 (.1) 0010 entropy = bits a 5 (.1) 0011

11 We can use a tree diagram to build the Huffman code Assignment of 0 and 1 to the branches is arbitrary and gives different Huffman codes with the same average codeword length Sometimes we use the counts of symbols instead of their probability We might draw the tree horizontally or vertically

12 Building a Huffman Code 1 a 2 (4) a 1 (2) 1 (6) 0 (10) a 3 (2) 0 (4) a 4 (1) 1 (2) 1 0 a 5 (1) 0 a 2 : 1 a 1 : 01 a 3 : 000 a 4 : 0010 a 5 : 0011

13 Huffman Codes Since the Huffman code which gives the optimal codes meets the Conditions #1, #2, #3 and #4, these conditions are also sufficient conditions. It can be shown that not only does Huffman s algorithm always give a right answer, but also, every right answer. For the proof see section in Information theory and data compression by D. Hankerson.

14 Minimum Variance Huffman Codes According to where in the list the combined source is placed, we obtain different Huffman codes with the same average length (same compression performance). In some applications we do not want the code word lengths to vary significantly from one symbol to another (example: fixed-rate channels). To obtain a minimum variance Huffman code, we always put the combined symbol as high in the list as possible.

15 a 2 (.4) a 1 (.2) a 3 (.2) a 4 (.1) a 5 (.1) Minimum Variance Huffman Codes a 2 (.4) 00 a 1 (.2) 10 a 3 (.2) 11 average length = 2.2 bits a 4 (.1) 010 entropy = bits a 5 (.1)

16 Huffman Codes The average length of a Huffman code satisfies H (S) l H(S) + 1 The upper bound is loose. A tighter bound is l H(S) + P H(S) + P + max max P P max max <

17 Extended Huffman Codes If the probability distribution is very skewed (large P max ), Huffman codes become inefficient. We can reduce the rate by grouping symbols together. Consider the source S of independent symbols with alphabet A={a 1,,a N }. Let us construct an extended source S (n) by grouping n symbols together Extended symbols in the extended alphabet (n) A = A A... (n times) A

18 Extended Huffman Codes: Example Huffman code (n = 1) Huffman code (n = 2) a a 1 a a a 1 a a a 3 a a 1 a R = 1.05 bits/symbol a 2 a H =.335 bits/symbol a 3 a a 3 a a 2 a a 2 a R =.611 bits/symbol Rate gets close to the entropy only for n > 7.

19 Extended Huffman Codes We can build a Huffman code for the extended source with a bit rate R (n) which satisfies H(S (n) ) R (n) H(S (n) ) + 1 But R = R (n) /n and, for i.i.d. sources, H(S) = H(S (n) )/n, so 1 H (S) R H(S) + n As n, R H(s). Complexity (memory, computations) also increases (exponentially). Slow convergence for skewed distributions.

20 Nonbinary Huffman Codes The code elements are coming from an alphabet with m>2 letters Observations 1. The m symbols that occur least frequently will have the same length 2. The m symbols with the lowest probability differ only in the last position Example: ternary Huffman code for a source with six letters First combine three letters with the lowest probability, giving us a reduced alphabet with 4 letters, Then combining three lowest probability gives us an alphabet with only two letters We have three values to assign and only two letters, we are wasting one of the code symbols

21 Nonbinary Huffman Codes Instead of combining three letters at the beginning we could have combined two letters, into an alphabet of size 5, If we combine three letters from this alphabet we end up in alphabet with a size of 3. We could combine three in the first step and two in the second step. Which one is better? Observation: all combine letters will have codewords of the same length Symbols with the lowest probability will have the longest codeword If at some stage we are allowed to combine less than m symbols the logical place is the very first stage In the general case of a code alphabet with m symbols (mary) and a source with N symbols, the number of letters combined in the first phase is: N modulo (m-1)

22 Adaptive Huffman Codes Two-pass encoders: first collect statistics, then build Huffman code and use it to encode source. One-pass (recursive) encoders: Develop the code based on the statistics of the symbols already encoded. The decoder can build its own copy in a similar way. Possible to modify code without redesigning entire tree. More complex than arithmetic coding.

23 Adaptive Huffman Codes Feature: no statistical study of the source text need to be done before hand The encoder keeps statistics in the form of counts of source letters, as the encoding proceeds, and modifies the encoding according to those statistics What about the decoder? if the decoder knows the rules and conventions under which the encoder proceeds, it will know how to decode the next letter Besides the code stream, the decoder should be supplied with the details of how encoder started and how the encoder will proceed in each situation

24 Adaptive Huffman Codes In adaptive Huffman coding, the tree and corresponding encoding scheme change accordingly Two versions of the adaptive Huffman will be described: 1. Primary version 2. Knuth and Gallager method

25 Primary version The leaf nodes (source letters) are sorted non-increasingly We merge from below in the case of a tie When two nodes are merged they are called siblings When two nodes are merged, the parent node will be ranked on the higher of the two sibling nodes. In the labeling of the edges (branches) of the tree, the edge going from parent to highest sibling is labeled zero At start all letters have a count of one Update after count increment: the assignment of leaf nodes to source letters is redone so that the weights are in nonincreasing order

26 Performance Adaptive Huffman codes: respond to locality Encoder is "learning" the characteristics of the source. The decoder must learn along with the encoder by continually updating the Huffman tree so as to stay in synchronization with the encoder. Another advantage: they require only one pass over the data. Of course, one-pass methods are not very interesting if the number of bits they transmit is significantly greater than that of the two-pass scheme. Interestingly, the performance of these methods, in terms of number of bits transmitted, can be better or worse than that of static Huffman coding. This does not contradict the optimality of the static method as the static method is optimal only over all methods which assume a time-invariant mapping.

27 Primary version The Huffman tree and associated encoding scheme are expected to settle down eventually to the fixed tree and scheme that might have arisen from counting the letters in a large sample of source text The advantage of adaptive Huffman encoding can be quite important in situations that the source nature changes Exp: a source text consists of a repeated 10,000 times, b repeated 10,000 times, c repeated 10,000 and d repeated 10,000. Non-adaptive Huffman: probability ¼, four binary codes each 2 bits

28 Primary version Adaptive Huffman: encode almost all a s by a single digit. The b s will be coded by two bits each, c s and d s with three bits each It is wasting the advantage over non-adaptive Huffman Source of problem: when the nature of the source text changes, one or more of the letters may have built up such a hefty counts that it takes a long time for the other letters to catch up Solution: periodically multiply all the counts by some fraction and round down (of course the decoder must know when and how much the counts are scaled down)

29 Knuth & Gallager method Problem with primary method: updating the tree The tree resulting from an application of Huffman s algorithm belong to a special class of diagrams called binary tree A binary tree with n leaf nodes has 2n-1 nodes and 2n-2 nodes other than the root Theorem: Suppose that T is a binary tree with n leaf nodes with each node y i assigned a non-negative weight x i. Suppose that each parent is weighted with the sum of the weights of its children. Then T is a Huffman tree (obtainable by some instance of Huffman s algorithm) if and only if 2n-2 non-root nodes of T can be arranged in a sequence y 1 y 2 y 2n-2 with the properties that 1. x x x n 2 2. y 2k-1 and y 2k are siblings

30 Knuth & Gallager method Knuth and Gallager proposed to manage the Huffman tree at each stage in adaptive Huffman encoding by ordering the nodes y 1 y 2 y 2n-2 so that he weight on y k is non-decreasing with k and so that y 2k-1 and y 2k are siblings This arrangement allows updating after a count increment in order of n operations, while redoing the whole tree from scratch requires order of n 2 operations.

31 Knuth & Gallager method Squares denote external nodes and correspond to the symbols Codeword for a symbol can be obtained by traversing the tree from root to the external node corresponding to the symbol, 0 corresponds to a left branch and 1 corresponds to a right branch Weight of a node: a number written inside the node For external nodes: number of times the symbol corresponding to the node has been encountered For internal nodes: sum of the weight of its off springs

32 Knuth & Gallager method Node number: a unique number assigned to each internal and external node Block: set of nodes with the same weight Node interchange: entire subtree being cut off and re-grafted in new position

33 Adaptive Huffman Codes Version 1: encoder is initialized with source alphabet with a count of one Send the binary code for the symbol (traverse the tree) If the node is the root, increase its weight and exit If the node has the highest node number in its block, increment its weight, update its parent. If the node does not have the highest node number, swap it with the node with highest number in the block, increment its weight, update its parents.

34 Adaptive Huffman Codes Update a node: If the node is the root, increase its weight and exit If the node has the highest node number in its block, increment its weight, update its parent. If the node does not have the highest node number, swap it with the node with highest number in the block, increment its weight, update its parents.

35 Start Go to the symbol external node Node number max in block? No Switch node with highest numbered node in block Yes Increment node weight Is this the root node? No Go to parent node Yes Stop

36 Adaptive Huffman Codes Version 2: no initialization is required At the beginning the tree consists of a single node called Not Yet Transmitted (NYT) with a weight of zero. If the symbol to be coded is new: An NYT and a fixed length code for the symbol is transmitted. In the tree, NYT is converted to a new NYT and an external node for the symbol. The weight of the new external node is set to one. The weight of the parent (old NYT) is set to one. The parent of the old NYT is updated. If the symbol already exists: Send the binary code for the symbol (traverse the tree) Update the node

37 Adaptive Huffman Codes Update a node: If the node is the root, increase its weight and exit If the node has the highest node number in its block, increment its weight, update its parent. If the node does not have the highest node number, swap it with the node with highest number in the block (as long as the node with the higher number is not the parent of the node being updated), increment its weight, update its parents.

38 Start NYT gives birth to new NYT and external node Yes First appearance? No Increment weight of external node and old NYT node Go to the symbol external node Go to old NYT Node number max in block? No Switch node with highest numbered node in block Yes Increment node weight Is this the root node? No Go to parent node Yes Stop

39 Adaptive Huffman Codes Fixed length coding: If the n symbols in the alphabet, we find e and r such that: If n 0 = 2 r of k-1 e < + r 2 e 1 k 2r then a k is coded as the (e+1)-bit binary representation If k>2r, a k is coded as the e-bit binary representation of k-r-1 Exp: n=26, e=4, r=10 a2: a22: 1011

40 a a r d v a r k 0 NYT a Adaptive Huffman Codes NYT NYT NYT 0 1 a r a r 48 NYT 0 1 d a

41 Adaptive Huffman Codes a a r d v a r k NYT r 48 1 d 46 v a r NYT a d 46 v a r NYT d 46 v

42 Golomb Codes Golomb-Rice codes belong to a family of codes designed to encode integers with the assumption that the larger an integer, the lower its probability of occurrence. Unary code: simple codes for this situation Unary code of an integer n is n 1s followed by a 0. Exp: 4 -> 11110

43 Golomb Codes Golomb codes: has a parameter m An integer n is represented by two numbers q and r: n q = m r = n qm q is unary coded r can take values 0,1,2,.., m-1 m a power of two: use the log2 Not a power of two: use the log m-bit representation of r m -bit representation of r 2

44 The number of bits can be reduced if we use log 2 m bit representation of r for the first log m 2 m values and log 2 bit binary representation of log2 r + 2 m m for the rest of values Exp: m=5, First 8-5=3 values of r (0,1,2) will be represented by 2 bits binary representation of r, and the next two values (3,4) will be represented by the 3-bit representation of r+3 (6,7) 14 -> Golomb Codes 2 m log 2 5 = 2 log 2 5 = 3

45 Rice codes Rice coding has two steps: preprocessing and coding Preprocessing: generates a sequence of nonnegative integers where smaller values are more probable than larger values

46 Rice codes }, min{ : } { min ^ ^ max max min 1 1 ^ ^ y y y y T y y y y y d y y y prediction y i i i i i i i i i i i = < < = = + = i i i i i d T d d x other d T T d i i i i 0 0 <

47 Rice codes 2di x = 2 d 1 i i T + d i i 0 d T i other i T d i i < 0 The preprocessed sequence is divided into segments with each segment being further divided into blocks of size J (e.g., 16) Each block is coded using one of the following options (the coded block is transmitted along with an identifier indicating the option used):

48 Rice codes Options 1. Fundamental sequence: unary code (n is coded as n 0s followed by a 1) 2. Split sample options: There is a parameter k A m-bit number n code consists of k least significant bits of n followed by the unary code of the m-k most significant bits 3. Second extension option: the sequence is divided into consecutive pairs of samples. Each pair is used to obtain an 1 index: γ = ( x + x )( x + x + 1) + x i i+ 1 i i+ 1 i+ 1, the index is coded using 2 a unary code. 4. Zero block option: used when one or more blocks are all zero. Number of zero blocks is transmitted using a code. See Table 3.17

49 Rice codes

50 Variable Length Codes & Error Propagation A 00 B 01 C 10 D 11 A B C D A B: A B C C A B A 0 B 10 C 110 D 111 A B C D A B: A B C A C B

51 Tunstall Codes In Tunstall code, all the codewords are of equal length. However, each codeword represents a different number of letters. Sequence Codeword AAA 00 AAB 01 AB 10 B 11

52 Tunstall code Design of an n bit Tunstall code for a source with an alphabet size of N Start with the N letters of the source alphabet in codebook Remove the entry in the codebook with highest probability and add the N string obtained by concatenating this letter with every letter in the alphabet (including itself) This increases the size of codebook from N to N+(N-1) Calculated the probabilities of the new entries Select the entry with the highest probability and repeat until the size of the code book reaches 2 n

53 Tunstall code Exp: S={A,B,C}, P(A)=0.6, P(B)=0.3, P(c)=0.1, n=3 bits Sequence P A 0.6 B 0.3 C 0.1 Sequence P B 0.3 C 0.1 AA 0.36 AB 0.18 AC 0.06 Sequence P B 000 C 001 AB 010 AC 011 AAA 100 AAB 101 AAC 110

### Chap 3 Huffman Coding

Chap 3 Huffman Coding 3.1 Overview 3.2 The Huffman Coding Algorithm 3.4 Adaptive Huffman Coding 3.5 Golomb Codes 3.6 Rice Codes 3.7 Tunstall Codes 3.8 Applications of Huffman Coding 1 3.2 The Huffman Coding

### Huffman Coding. National Chiao Tung University Chun-Jen Tsai 10/2/2014

Huffman Coding National Chiao Tung University Chun-Jen Tsai 10/2/2014 Huffman Codes Optimum prefix code developed by D. Huffman in a class assignment Construction of Huffman codes is based on two ideas:

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 14 Non-Binary Huffman Code and Other Codes In the last class we

### Almost every lossy compression system contains a lossless compression system

Lossless compression in lossy compression systems Almost every lossy compression system contains a lossless compression system Lossy compression system Transform Quantizer Lossless Encoder Lossless Decoder

### Name: Shu Xiong ID:

Homework #1 Report Multimedia Data Compression EE669 2013Spring Name: Shu Xiong ID: 3432757160 Email: shuxiong@usc.edu Content Problem1: Writing Questions... 2 Huffman Coding... 2 Lempel-Ziv Coding...

### Lec 03 Entropy and Coding II Hoffman and Golomb Coding

Outline CS/EE 559 / ENG 4 Special Topics (Class Ids: 784, 785, 783) Lecture ReCap Hoffman Coding Golomb Coding and JPEG Lossless Coding Lec 3 Entropy and Coding II Hoffman and Golomb Coding Zhu Li Z. Li

### 5.4. HUFFMAN CODES 71

5.4. HUFFMAN CODES 7 Corollary 28 Consider a coding from a length n vector of source symbols, x = (x... x n ), to a binary codeword of length l(x). Then the average codeword length per source symbol for

### Shannon and Huffman-Type Coders

Shannon and Huffman-Type Coders A useful class of coders that satisfy the Kraft's inequality in an efficient manner are called Huffman-type coders. To understand the philosophy of obtaining these codes,

Adaptive Huffman coding If we want to code a sequence from an unknown source using Huffman coding, we need to know the probabilities of the different symbols. Most straightforward is to make two passes

### Lecture 17: Huffman Coding

Lecture 17: Huffman Coding CLRS- 16.3 Outline of this Lecture Codes and Compression. Huffman coding. Correctness of the Huffman coding algorithm. 1 Suppose that we have a 100, 000 character data file that

### Inverted Indexes Compressed Inverted Indexes. Indexing and Searching, Modern Information Retrieval, Addison Wesley, 2010 p. 40

Inverted Indexes Compressed Inverted Indexes Indexing and Searching, Modern Information Retrieval, Addison Wesley, 2010 p. 40 Compressed Inverted Indexes It is possible to combine index compression and

### Information, Entropy, and Coding

Chapter 8 Information, Entropy, and Coding 8. The Need for Data Compression To motivate the material in this chapter, we first consider various data sources and some estimates for the amount of data associated

### and the bitplane representing the second most significant bits is and the bitplane representing the least significant bits is

1 7. BITPLANE GENERATION The integer wavelet transform (IWT) is transformed into bitplanes before coding. The sign bitplane is generated based on the polarity of elements of the transform. The absolute

### CSC 310: Information Theory

CSC 310: Information Theory University of Toronto, Fall 2011 Instructor: Radford M. Neal Week 2 What s Needed for a Theory of (Lossless) Data Compression? A context for the problem. What are we trying

### Signal Compression Survey of the lectures Hints for exam

Signal Compression Survey of the lectures Hints for exam Chapter 1 Use one statement to define the three basic signal compression problems. Answer: (1) designing a good code for an independent source;

### Compression for IR. Lecture 5. Lecture 5 Information Retrieval 1

Compression for IR Lecture 5 Lecture 5 Information Retrieval 1 IR System Layout Lexicon (w, *occ) Occurrences (d, f t,d ) Locations (d, *pos) Documents 2 Why Use Compression? More storage inverted file

### ECEN 5682 Theory and Practice of Error Control Codes

ECEN 5682 Theory and Practice of Error Control Codes Convolutional Codes University of Colorado Spring 2007 Linear (n, k) block codes take k data symbols at a time and encode them into n code symbols.

### character E T A S R I O D frequency

Data Compression Data compression is any process by which a digital (e.g. electronic) file may be transformed to another ( compressed ) file, such that the original file may be fully recovered from the

### The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science

Trees Mathematically speaking trees are a special class of a graph. The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science However, in computer

### Arithmetic Coding: Introduction

Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation

### Image Compression. Topics

Image Compression October 2010 Topics Redundancy Image information Fidelity Huffman coding Arithmetic coding Golomb code LZW coding Run Length Encoding Bit plane coding 1 Why do we need compression? Data

### CS383, Algorithms Notes on Lossless Data Compression and Huffman Coding

Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Fulton Hall 410 B alvarez@cs.bc.edu Computer Science Department voice: (617) 552-4333 Boston College fax: (617) 552-6790 Chestnut Hill, MA 02467 USA

### Compression techniques

Compression techniques David Bařina February 22, 2013 David Bařina Compression techniques February 22, 2013 1 / 37 Contents 1 Terminology 2 Simple techniques 3 Entropy coding 4 Dictionary methods 5 Conclusion

### Lab Session 4. Review. Outline. May 18, Image and video encoding: A big picture

Outline Lab Session 4 May 18, 2009 Review Manual Exercises Comparing coding performance of different codes: Shannon code, Shannon-Fano code, Huffman code (and Tunstall code *) MATLAB Exercises Working

### Chapter 3: Digital Audio Processing and Data Compression

Chapter 3: Digital Audio Processing and Review of number system 2 s complement sign and magnitude binary The MSB of a data word is reserved as a sign bit, 0 is positive, 1 is negative. The rest of the

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### Binary Codes for Nonuniform

Binary Codes for Nonuniform Sources (dcc-2005) Alistair Moffat and Vo Ngoc Anh Presented by:- Palak Mehta 11-20-2006 Basic Concept: In many applications of compression, decoding speed is at least as important

### International Journal of Advanced Research in Computer Science and Software Engineering

Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:

### Binary Trees and Huffman Encoding Binary Search Trees

Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary

### Gambling and Data Compression

Gambling and Data Compression Gambling. Horse Race Definition The wealth relative S(X) = b(x)o(x) is the factor by which the gambler s wealth grows if horse X wins the race, where b(x) is the fraction

### Image Compression through DCT and Huffman Coding Technique

International Journal of Current Engineering and Technology E-ISSN 2277 4106, P-ISSN 2347 5161 2015 INPRESSCO, All Rights Reserved Available at http://inpressco.com/category/ijcet Research Article Rahul

### Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

### Mathematical Induction. Lecture 10-11

Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

### Probability Interval Partitioning Entropy Codes

SUBMITTED TO IEEE TRANSACTIONS ON INFORMATION THEORY 1 Probability Interval Partitioning Entropy Codes Detlev Marpe, Senior Member, IEEE, Heiko Schwarz, and Thomas Wiegand, Senior Member, IEEE Abstract

### CS 441 Discrete Mathematics for CS Lecture 16. Counting. CS 441 Discrete mathematics for CS. Course administration

CS 44 Discrete Mathematics for CS Lecture 6 Counting Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Course administration Midterm exam: Thursday, March 6, 24 Homework assignment 8: due after Spring

### 4.8 Huffman Codes. These lecture slides are supplied by Mathijs de Weerd

4.8 Huffman Codes These lecture slides are supplied by Mathijs de Weerd Data Compression Q. Given a text that uses 32 symbols (26 different letters, space, and some punctuation characters), how can we

### Lecture 7: Approximation via Randomized Rounding

Lecture 7: Approximation via Randomized Rounding Often LPs return a fractional solution where the solution x, which is supposed to be in {0, } n, is in [0, ] n instead. There is a generic way of obtaining

### Search Trees for Strings

Search Trees for Strings A balanced binary search tree is a powerful data structure that stores a set of objects and supports many operations including: Insert and Delete. Lookup: Find if a given object

### Class Notes CS 3137. 1 Creating and Using a Huffman Code. Ref: Weiss, page 433

Class Notes CS 3137 1 Creating and Using a Huffman Code. Ref: Weiss, page 433 1. FIXED LENGTH CODES: Codes are used to transmit characters over data links. You are probably aware of the ASCII code, a fixed-length

### Exercises with solutions (1)

Exercises with solutions (). Investigate the relationship between independence and correlation. (a) Two random variables X and Y are said to be correlated if and only if their covariance C XY is not equal

### Mathematical induction & Recursion

CS 441 Discrete Mathematics for CS Lecture 15 Mathematical induction & Recursion Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Proofs Basic proof methods: Direct, Indirect, Contradiction, By Cases,

### Background. Linear Convolutional Encoders (2) Output as Function of Input (1) Linear Convolutional Encoders (1)

S-723410 Convolutional Codes (1) 1 S-723410 Convolutional Codes (1) 3 Background Convolutional codes do not segment the data stream, but convert the entire data stream into another stream (codeword) Some

### Postings Lists - Reminder

Introduction to Search Engine Technology Index Compression Ronny Lempel Yahoo! Labs, Haifa (Some of the following slides are courtesy of Aya Soffer and David Carmel, IBM Haifa Research Lab) Postings Lists

### Module 6. Channel Coding. Version 2 ECE IIT, Kharagpur

Module 6 Channel Coding Lesson 35 Convolutional Codes After reading this lesson, you will learn about Basic concepts of Convolutional Codes; State Diagram Representation; Tree Diagram Representation; Trellis

### Reduce the amount of data required to represent a given quantity of information Data vs information R = 1 1 C

Image Compression Background Reduce the amount of data to represent a digital image Storage and transmission Consider the live streaming of a movie at standard definition video A color frame is 720 480

### IMPROVED GOLOMB CODE FOR JOINT GEOMETRIC DISTRIBUTION DATA AND ITS APPLICATIONS IN IMAGE PROCESSING

IMPROVED GOLOMB CODE FOR JOINT GEOMETRIC DISTRIBUTION DATA AND ITS APPLICATIONS IN IMAGE PROCESSING Jian-Jiun Ding ( 丁建均 ), Soo-Chang Pei ( 貝蘇章 ), Wei-Yi Wei ( 魏維毅 ) Tzu-Heng Henry Lee ( 李自恆 ) Department

### Foundation of Video Coding Part I: Overview and Binary Encoding

Foundation of Video Coding Part I: Overview and Binary Encoding Yao Wang Polytechnic University, Brooklyn, NY11201 http://eeweb.poly.edu Based on: Y. Wang, J. Ostermann, and Y.-Q. Zhang, Video Processing

### Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

### The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

### Chapter There are non-isomorphic rooted trees with four vertices. Ans: 4.

Use the following to answer questions 1-26: In the questions below fill in the blanks. Chapter 10 1. If T is a tree with 999 vertices, then T has edges. 998. 2. There are non-isomorphic trees with four

### 6 Creating the Animation

6 Creating the Animation Now that the animation can be represented, stored, and played back, all that is left to do is understand how it is created. This is where we will use genetic algorithms, and this

### Why? A central concept in Computer Science. Algorithms are ubiquitous.

Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### Image compression. Stefano Ferrari. Università degli Studi di Milano Elaborazione delle immagini (Image processing I)

Image compression Stefano Ferrari Università degli Studi di Milano stefano.ferrari@unimi.it Elaborazione delle immagini (Image processing I) academic year 2011 2012 Data and information The representation

### Cyclic Codes Introduction Binary cyclic codes form a subclass of linear block codes. Easier to encode and decode

Cyclic Codes Introduction Binary cyclic codes form a subclass of linear block codes. Easier to encode and decode Definition A n, k linear block code C is called a cyclic code if. The sum of any two codewords

### Lecture 2: The Complexity of Some Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 2: The Complexity of Some Problems David Mix Barrington and Alexis Maciel July 18, 2000

### Full and Complete Binary Trees

Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

### Information Retrieval

Information Retrieval ETH Zürich, Fall 2012 Thomas Hofmann LECTURE 4 INDEX COMPRESSION 10.10.2012 Information Retrieval, ETHZ 2012 1 Overview 1. Dictionary Compression 2. Zipf s Law 3. Posting List Compression

### Discrete Mathematics, Chapter 5: Induction and Recursion

Discrete Mathematics, Chapter 5: Induction and Recursion Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 5 1 / 20 Outline 1 Well-founded

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### On the Determination of Optimal Parameterized Prefix Codes for Adaptive Entropy Coding

On the Determination of Optimal Parameterized Prefix Codes for Adaptive Entropy Coding Amir Said Media Technologies Laboratory HP Laboratories Palo Alto HPL-2006-74 April 28, 2006* entropy coding, Golomb-Rice

### CHAPTER 5 A MEMORY EFFICIENT SPEECH CODING SCHEME WITH FAST DECODING

86 CHAPTE A MEMOY EFFICIENT SPEECH CODING SCHEME WITH FAST DECODING. INTODUCTION Huffman coding proposed by Huffman (9) is the most widely used minimal prefix coding algorithm because of its robustness,

### SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers. Factors 2. Multiples 3. Prime and Composite Numbers 4. Modular Arithmetic 5. Boolean Algebra 6. Modulo 2 Matrix Arithmetic 7. Number Systems

### Relative Data Redundancy

Image Compression Relative Data Redundancy Let b and b denote the number of bits in two representations of the same information, the relative data redundancy R is R = 1-1/C C is called the compression

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### Discovery of Huffman codes

Discovery of Huffman codes Inna Pivkina 1 Introduction The story of the invention of Huffman codes is described in an article by Gary Stix in the September 1991 issue of Scientific American, pp. 54, 58

### EP A1 (19) (11) EP A1. (12) EUROPEAN PATENT APPLICATION published in accordance with Art. 158(3) EPC

(19) (12) EUROPEAN PATENT APPLICATION published in accordance with Art. 8(3) EPC (11) EP 1 962 14 A1 (43) Date of publication: 27.08.08 Bulletin 08/3 (21) Application number: 06828244.1 (22) Date of filing:

### Why is the number of 123- and 132-avoiding permutations equal to the number of binary trees?

Why is the number of - and -avoiding permutations equal to the number of binary trees? What are restricted permutations? We shall deal with permutations avoiding some specific patterns. For us, a permutation

LZ77 The original LZ77 algorithm works as follows: A phrase T j starting at a position i is encoded as a triple of the form distance, length, symbol. A triple d, l, s means that: T j = T [i...i + l] =

### ENSC 861 Source Coding in Digital Communications Golomb-Rice Code

ENSC 861 Source Coding in Digital Communications Golomb-Rice Code Jie Liang Engineering Science Simon Fraser University JieL@sfu.ca J. Liang SFU ENSC861 1 Outline Unary Code Golomb Code Golomb-Rice Code

### GRAPH THEORY LECTURE 4: TREES

GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection

### Analysis of Compression Algorithms for Program Data

Analysis of Compression Algorithms for Program Data Matthew Simpson, Clemson University with Dr. Rajeev Barua and Surupa Biswas, University of Maryland 12 August 3 Abstract Insufficient available memory

### CSE 5311 Homework 2 Solution

CSE 5311 Homework 2 Solution Problem 6.2-6 Show that the worst-case running time of MAX-HEAPIFY on a heap of size n is Ω(lg n). (Hint: For a heap with n nodes, give node values that cause MAX- HEAPIFY

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

Chapter 7. Indexes Table of Contents Objectives... 1 Introduction... 2 Context... 2 Review Questions... 3 Single-level Ordered Indexes... 4 Primary Indexes... 4 Clustering Indexes... 8 Secondary Indexes...

### Trees and Fundamental Circuits

Trees and Fundamental Circuits Tree A connected graph without any circuits. o must have at least one vertex. o definition implies that it must be a simple graph. o only finite trees are being considered

### Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

### Sophomore College Mathematics of the Information Age Entropy

Sophomore College Mathematics of the Information Age Entropy Let s recall the fundamental notions of information and entropy. To repeat from the first class, Shannon s emphasis is on selecting a given

### Mathematical Induction

Mathematical Induction Victor Adamchik Fall of 2005 Lecture 2 (out of three) Plan 1. Strong Induction 2. Faulty Inductions 3. Induction and the Least Element Principal Strong Induction Fibonacci Numbers

### A. V. Gerbessiotis CS Spring 2014 PS 3 Mar 24, 2014 No points

A. V. Gerbessiotis CS 610-102 Spring 2014 PS 3 Mar 24, 2014 No points Problem 1. Suppose that we insert n keys into a hash table of size m using open addressing and uniform hashing. Let p(n, m) be the

### Chapter 2 Limits Functions and Sequences sequence sequence Example

Chapter Limits In the net few chapters we shall investigate several concepts from calculus, all of which are based on the notion of a limit. In the normal sequence of mathematics courses that students

### Data Compression Techniques. Lecture 4: Integer Codes II

University of Helsinki Department of Computer Science 582487 Data Compression Techniques Lecture 4: Integer Codes II Simon J. Puglisi (puglisi@cs.helsinki.fi) Books (again) Remember how Google works?

### Chapter 7: Termination Detection

Chapter 7: Termination Detection Ajay Kshemkalyani and Mukesh Singhal Distributed Computing: Principles, Algorithms, and Systems Cambridge University Press A. Kshemkalyani and M. Singhal (Distributed Computing)

### Today. Data Representation. Break: Binary Numbers. Representing Text. Representing Images. 18:30(ish) 15 Minute Break

Introduction Today Data Representation Binary Numbers Representing Text Representing Images Break: 18:30(ish) 15 Minute Break Why Data Representation? GCSE syllabus has an entire Module on data representation.

### For decimal numbers we have 10 digits available (0, 1, 2, 3, 9) For binary numbers we have 2 digits available, 0 and 1.

Math 167 Ch 17 Review 1 (c) Janice Epstein, 2014 CHAPTER 17 INFORMATION SCIENCE Binary and decimal numbers a short review: For decimal numbers we have 10 digits available (0, 1, 2, 3, 9) 4731 = For binary

### Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

### Techniques Covered in this Class. Inverted List Compression Techniques. Recap: Search Engine Query Processing. Recap: Search Engine Query Processing

Recap: Search Engine Query Processing Basically, to process a query we need to traverse the inverted lists of the query terms Lists are very long and are stored on disks Challenge: traverse lists as quickly

### 2015:07. Tree Approximation for hp- Adaptivity. Peter Binev

INTERDISCIPLINARY MATHEMATICS INSTITUTE 205:07 Tree Approximation for hp- Adaptivity Peter Binev IMI PREPRINT SERIES COLLEGE OF ARTS AND SCIENCES UNIVERSITY OF SOUTH CAROLINA Tree Approximation for hp-adaptivity

### Linear Codes. Chapter 3. 3.1 Basics

Chapter 3 Linear Codes In order to define codes that we can encode and decode efficiently, we add more structure to the codespace. We shall be mainly interested in linear codes. A linear code of length

### 7.1 Introduction. CSci 335 Software Design and Analysis III Chapter 7 Sorting. Prof. Stewart Weiss

Chapter 7 Sorting 7.1 Introduction Insertion sort is the sorting algorithm that splits an array into a sorted and an unsorted region, and repeatedly picks the lowest index element of the unsorted region

### 1. What s wrong with the following proofs by induction?

ArsDigita University Month : Discrete Mathematics - Professor Shai Simonson Problem Set 4 Induction and Recurrence Equations Thanks to Jeffrey Radcliffe and Joe Rizzo for many of the solutions. Pasted

### 6.1 General-Purpose Data Compression

6 Index Compression An inverted index for a given text collection can be quite large, especially if it contains full positional information about all term occurrences in the collection. In a typical collection

### Introduction Number Systems and Conversion

UNIT 1 Introduction Number Systems and Conversion Objectives 1. Introduction The first part of this unit introduces the material to be studied later. In addition to getting an overview of the material

### 2 Exercises and Solutions

2 Exercises and Solutions Most of the exercises below have solutions but you should try first to solve them. Each subsection with solutions is after the corresponding subsection with exercises. 2.1 Sorting

### Principle of (Weak) Mathematical Induction. P(1) ( n 1)(P(n) P(n + 1)) ( n 1)(P(n))

Outline We will cover (over the next few weeks) Mathematical Induction (or Weak Induction) Strong (Mathematical) Induction Constructive Induction Structural Induction Principle of (Weak) Mathematical Induction

### Communications Systems Laboratory. Department of Electrical Engineering. University of Virginia. Charlottesville, VA 22903

Turbo Trellis Coded Modulation W. J. Blackert y and S. G. Wilson Communications Systems Laboratory Department of Electrical Engineering University of Virginia Charlottesville, VA 22903 Abstract Turbo codes

### Scheduling. Open shop, job shop, flow shop scheduling. Related problems. Open shop, job shop, flow shop scheduling

Scheduling Basic scheduling problems: open shop, job shop, flow job The disjunctive graph representation Algorithms for solving the job shop problem Computational complexity of the job shop problem Open

### Implementation and Analysis of Efficient Lossless Image Compression Algorithm

International Journal of Engineering and Technical Research (IJETR) ISSN: 2321-0869, Volume-2, Issue-6, June 2014 Implementation and Analysis of Efficient Lossless Image Compression Algorithm Prof.Megha