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

Save this PDF as:

Size: px
Start display at page:

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

## Transcription

1 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 studied the procedure to construct a non binary Huffman code. We saw that the procedure is similar to the construction of a binary Huffman code. The difference being that at each stage of source reduction we combine r symbols instead of two symbols, where r stands for the size of the code alphabet. And we have also seen that at each stage of source reduction the source symbols will reduce by r minus 1. (Refer Slide Time: 01:40) And if at the final stage we want that there should be r symbols then the total number of symbols which should be existing in the original alphabet should be of the form r plus alpha times r minus 1, where alpha is a integer and r is the size of the code alphabet. Now, the only hitch was that if this condition is not satisfied, then we said that we can add some dummy variables with probability 0, and then combine r symbols at each stage of source reduction. And in the final stage, when we are getting the code for the, code word for the particular symbol we ignore the code words for the dummy symbols. Now, let us look at that

2 procedure which the aid of an illustration. Let us say that I have a source consisting of 6 symbols. So, S is given by S 1, S 2, S 3, S 4, S 5 and S 6 and I need to find out the code which is a Huffman code and the alphabet, code alphabet is a ternary. So, the code alphabet is 0, 1, 2. So, let us assume that probabilities have been given to us as 0.2, probability of 0.25 and P 6. So, probability of S 2 is So, the first step is to generate a non binary Huffman code for the source with this code alphabet is to arrange the symbols in the descending order of probability. So, S , S 1 is 0.20, S , S 4, S sorry this is 0.01 and finally, S 2 is So, this is 0.10 that is S 6. Now, we have six source symbols and if we look at the expression, this expression, this expression will be of form 3 plus 2 alpha. So, this 6 is not of this form where alpha is integer. So, if I add one dummy variable then I will get 7 and this can become of the form 2 into alpha is equal to 2. I will get this equal to this. So, I had one dummy variable. So, let us add a dummy variable S 7 with a probability of 0.0. Now, once we have done this then we combine this three elements at this I get as So, I will just indicate, I get here S 5, S 1, S 3, S 4 and this is S 6 dash and this is 0.25, 0.20, 0.20, 0.20 and Then again I combine this two three and place it on the top. I get S 3 dash 0.55, this will be S 5 that is 0.25 and this is S Once we have got the three symbols because r is equal to 3. Now, we can allot this as 0, 1, 2, allot here as 0, 1, 2, final lot 0, 1, 2 and based on this we can find out the code turns out to be S 1 is 2, S 2 is 0 2 1, S 3 is 0 0, S 4 is 0 1, S 5 is 1 and S 6 is 0 2 0, S 7 actually would be 0 2 2, but this is a dummy variable. So, we discard this. So, we get the code words corresponding to our symbols as this and this can be also depicted in form of a code tree. So, the code tree for this would like something like this.

3 (Refer Slide Time: 08:34) So, this is your root node I had here is S 1, this is my S 5, this would be S 3, this would be S 4, this would be S 6 and this would be S 2 and this is actually S 7 which is discarded and we follow the convention 0 1 2, 0 1 2, 0 1. So, once we have the tree we can also obtain the code words for this symbol by traversing from the root node to the leaves. So, S 3 would be 0 0 and S 2 would be which is the same as what we have got it here. Now, we can calculate the average length for this code. So, the average length turns out to be there, we have one code word of length 1 and two code words of length 1 and two code lengths of length 2 and code lengths of 3. So, if we calculate that this will turn out to be 1 into 0.5, 2 into 0.40 plus 3 into 0.15 and this is equal to 0.5 plus point So, this is 1.70 ternary digits per symbol, ternary digits per symbol. Now, this is the optimum three array Huffman code for the given source. Now, if we had not followed this procedure, but an what we mean by that if we had not added this S 7 and if we had combined 3 and then again 3 and then 2 then we would have got another tree. And another way of combining would be combine 3 then combine 2 and then combine again 3. So, let us look at those tree structures.

4 (Refer Slide Time: 11:38) So, if I combine 3 3 and 2 then I get it as S 5 S 1 S 3 S 4 S 6 S and Now, without adding any dummy symbol we will add up, we will get a reduced source by combining the three source symbols and then place it here. I will just indicate the probabilities of the new symbols. So, this 0.35 and then this would be 0.25, this would be 0.0 and finally, this would be And then we combine again this three and then to get finally, two symbols 0.65 and Now, we can allot 0 1, 0 1 2, and we go from trace the path from here to here for each symbol. We will get the code word as S 1, S 2 as 1 2, S 3 as 0 2, S 4 as 1 0, S 5 as 0 0 and S 6 as 1 1 and this can be indicated in the form of a tree as, this is 0 and this is 1, this is 0 1 2, and this of course this leaves or external node correspond to the symbols as shown here, S 6, S 2. So, here all the code words of length 2, so the average length will turn out to be as 2 ternary digits per source symbol. And finally, we can so let us call this as average 2 and finally, we will follow the procedure as given here.

5 (Refer Slide Time: 14:53) I have S 5, S 1, S 3, S 4, S 6, S 2, 0.25, 0.20, 0.20, 0.20, 0.10, So, initially I combine three symbols I get a new source symbol. I place it here, I just indicate the new probabilities then I place it here, here and place it here. This are 0.25, 0.20 and Now, I combine two elements to get a reduction on then source. So, this is 0.40, 0.35 and finally So, in the final stage again I have three symbols, but in this procedure in between I have combined only two symbols. So, for lot 0 1 2, lot 0 1, and get the source code for each symbol would be given as follows, 1 1. And again I can draw the binary tree for this and the average length in this case, let us call as average length as 3. That turns out be 2 into 0.75 plus 0.25 is equal to 1.75 ternary digits per symbol. So, the first case we got L as 1.70, second case we got as 2 and the third case we got as So, this is the lowest value which we got and this is the value which we will get if we follow the procedure discussed where we combine r symbols at a time at each stage of source reduction. So finally, we reach with the alphabet, which consist of only r symbol. And if the initial number of symbols in the source alphabet does not follow the expression r plus alpha r minus 1 then we add some dummy symbols and with the probability 0. So, we have looked at the Huffman coding algorithms for both for the binary case and the non binary case. Although, the Huffman coding algorithm is one of the best known variable coding

6 length algorithm there are some lesser known algorithms that can be useful in certain situations. In particular there are two algorithms. (Refer Slide Time: 18:45) One is what is known as Golomb s algorithm, that is Golomb s codes and another is Tunstall codes. Both these codes are becoming increasingly popular. So, we will discuss this codes next. So, let us take first the Golomb codes. (Refer Slide Time: 19:19) The Golomb codes belong to a family of codes designed to encode integer with the assumption that the larger an integer the lower its probability of occurrence. The simplest

7 code for this situation is the unary code. The unary code for a positive integer n is simply n one s followed by a 0 or n zeros followed by a 1. Thus the code for 4 would be and the code for 7 would be seven one s followed by a 0. The unary code is the same as the Huffman code for the semi infinite alphabet 1, 2, 3 with probability model P k equal to 1 by 2 raise to k. Because the Huffman code is optimal the unary code is also optimal for this probability model. Although, the unary code is optimal in very restricted conditions we can see that it is certainly very simple to implement. One step higher in complexity are a number of coding schemes that split the integer into 2 parts, representing one part with a unary code and other with a different code. An example of such a code is the Golomb code. The Golomb code is actually a family of codes parameterized by integer m which is greater than 0. In the Golomb code with parameter m we represent an integer n greater than 0 using two numbers q and r. So, n is represented with the help of two numbers which are q and r. Let us see what are this q and r. q is equal to the truncation value of n by m and there by definition the lower flow means the integer part of x. And r is given by n minus q m. So, q is the quotient and r is the remainder. So, q can take all values all positive integers and it is represented by the unary code for q, whereas r can take all the values up to m minus 1. If m is a power of 2 we use the log 2 of m bit binary representation of r, but if m is not a power of 2 we could still use log to m the upper flow of this number to represent r. Now, when we represent using this strategy the number of bits required would be higher than the number of bits required by following the following strategy. So, if m is not a power of 2 we can reduce the number of bits required if we use the following strategy.

8 (Refer Slide Time: 24:18) We represent r by the lower flow of this value with representation of r for the first 2 raise to upper flow of log 2 m minus m values. So, for all the values of r which are less then this quantity will represent it r by lower flow of log to m bit binary representation. And we will use upper flow of log 2 m bit binary representation of r plus 2 log 2 m minus m for the rest of the values. In order to understand this in a much better way let us take up a simple example. (Refer Slide Time: 26:09)

9 So, let us take an example where a Golomb code parameterized by m equal to 5. So, m is equal to 5 in this case the upper flow of log 2 5 is equal to 3. This is the integer which is just larger than this value and the lower flow of log 2 5 is equal to 2. So, the first 2 raise to log 2 5 minus 5 that is 3 values of r which are 0 1 and 2 will be represented. This values of r will be represented by 2 bit binary representation and the next two values of r which is 3 and 4 will be represented by the, this will be represented by 3 bit binary representation of r plus 3. So, the q is always represented by the unary code for q. So, if we take Golomb code of 4. So, take 4, 4 I divide by 5, I will get it as 0 multiplied by 5 plus 4. So, in this case q is equal to 0. So, the unary representation of 0 would be 0 and this is r is equal to 4. Since, r 4 has to be represented by 3 binary representations of r plus 3, so 4 plus 3 is 7. So, binary representation of 7 is Similarly, the code word for 14 would be 14 by 5 would give me 2 multiplied by 5 plus 4. So, the quotient is 2 and this by unary representation would be and the remainder is 4. So, again the representation would be this. And let us take a simple case. Another finally, 7, so for 7 this can be represented as 1 into 5 plus 2. So, unary representation form 1 would be 1 0 and 2 is in this range. So, it is represented by 2 bit binary that would be 1 0. So, I get this is a Golomb representation for Golomb codes for different integer values. Now, we look at another code that is the Tunstall codes. (Refer Slide Time: 30:01)

10 So, let us look at the design of the Tunstall code. Most of the variable length coding algorithms that we have studied encode letters from the source alphabet using code words with varying numbers of bit. What it means that code words with fewer bits for letters that occur more frequently and code words with more bits for letters that occur less frequency. The Tunstall codes is an important exception. In the Tunstall code all code words are of equal length. However, each code word represents a different number of letters. An example of a 2 bit Tunstall code would be for an alphabet X given by say A and B would be shown in this figure is the sequence and I have a code word. So, if I have a sequence A A A the code word would be 0 0, if I have a sequence A A B the code word is 0 1, if it is A B it is 1 0 and if it is B it is 1 1. So, this is an example of 2 bit Tunstall code for the alphabet A B. The main advantage of a Tunstall code is that errors in code words do not propagate unlike other variable length codes such as Huffman codes in which an error in one code word will cause a series of errors to occur. Now, let us take this 2 bit Tunstall code and encode the following sequence. So, if I have a sequence given by triple A B and let us use this 2 bit Tunstall code. So, the first thing is basically you pass the source output sequence into sequences of symbols that appear in the code book. So, the first step is when I get the sequence I can pass it as sequences like this. And now for this sub sequences in the source sequence you code it using this 2 bit Tunstall code which we have given here. So, A A would be 0 0, B would be 1 1, A A B would be Now, the design of a code that has a fixed code word lengths, but a variable number of symbols for code word should satisfy the following conditions.

11 (Refer Slide Time: 34:07) So, the first condition which it should satisfy is we should be able to pass a source output sequence into sub sequences of symbols that appear in the code book. Second, we should maximize the average number of source symbols represented by each code word. Now, in order to understand what we mean, what we mean by the first condition consider codes shown in the table below. I have a sequence here and the code word as follows for A A I have 0 0, for A B A I have 0 1, A B I have 1 0 and B I have 1 1. Now, actually this an example of 2 bit non Tunstall code. Let us see if I have a code of this form. Then can I represent it my the original sequence which I considered earlier of the form A A, B, A A B. If we take this source output sequence and then the first thing we should do is we should able to pass a source output sequence into sub sequences of symbols that appear in the code book. So, if I get this I can pass it as it like this. So, for 0 0 because available in the code I can give a 0 0, for B i can put as 1 1, but now, from this point onwards I cannot pass this sequence into sequences of symbols that appear in the code book. So, this sequence is uncodable using this particular code and this is not a desirable condition. So, Tunstall he gave a simple algorithm that fulfills this condition of able to pass a source output sequences into a sequences of symbol that appear in the code book. The algorithm is as follows. So, the first things is suppose we want an n bit Tunstall code

12 for the source that generates identically independent distributed letters from an alphabet of size capital N. (Refer Slide Time: 38:34) So, the alphabet size that is the source alphabet is N and we require to generate n bit Tunstall code for this source. And this source generates identically independent distributed letters. So, the number of code words which we can have would be equal to 2 raise to n. So, the first thing is to, we start with the N letters of the source alphabet in our code book. So, we place in our code book the N letters of the source alphabet. Then the next step is remove the entry in the code book that has the highest probability. And then you add N strings obtained by concatenating this letter which you have removed with every letter in the alphabet. So, add N strings obtained concatenating this letter which we have removed with every letter in the source alphabet including that letter itself. So, this will increase the size of the code book from N to N plus N minus 1. And the probabilities of the new entries will be the product of the probabilities of the letters concatenated to form the new entry. And now, look through the N plus N minus 1 entries in the whole book and find the entry that has the highest probability keeping in mind that the entry with the highest probability may be a concatenation of symbols. Then, once we have found out the, that symbol with the highest probability, remove this entry and add the N strings obtained by concatenating this entry which we have removed

13 with every letter in the alphabet. So, again you repeat the same procedure of the step 2 of obtaining N strings by concatenating the letter which we are removing from the code book. Now, the size of code book will become N plus 2 N minus 1. So, each time we perform this operation we increase the size of the code book by N minus 1. Therefore, this operation can be performed K times where N plus K N minus 1 should be less than equal to 2 raise to n which is the number of code books, code words which we can form out of n bit. Let us take a simple example to understand this. (Refer Slide Time: 43:33) So, if I have a source consisting of a 3 alphabets with probability of A equal to 0.6, probability of B equal to 0.3 and probability of C equal to 0.1. Then the first thing you do is you start with the three entries A B C, this have probability 0.60, 0.30, In this the first step, letter A has the highest probability. So, remove it. So, what is left out is B and C and then you get 3 more strings because the size of the alphabet is 3, get 3 more strings which have been obtained by concatenating the letters from this source to this A. So, I will get A A, A B and A C. So, the probabilities would be 0.30, 0.10, 0.36, 0.18 and Now, again from here I find this is of the highest probability. So, remove it. So, what is left out is B C, A B, A C and now after I remove this I get 3 more strings by concatenating the letters from this alphabet to this entry. So, I get A A B and A A C and now if I carry out one more iteration I will get 9 sequences. And since 9 exceeds 2 raise

14 to 3 I have to stop at this point. And now, once I have reached this I can give the code word as , 0 1 0, 0 1 1, 1 0 0, 1 0 1, So, this I have my code words which I have formed for this sequence and this would be 3 bit Tunstall code. So, using this 3 bit Tunstall code you can again code the earlier sequence. So, we have looked at some of the coding strategies and we have seen that Huffman coding requires I mean it is the optimal and it also requires the knowledge of the probabilities of the source sequence. Now, for Huffman coding which is an optimal coding scheme if this knowledge is not available then Huffman coding becomes a 2 pass procedure. In the first pass the statistics are collected and in the second pass the source is encoded. Now, in order to convert this algorithm into a 1 pass procedure adaptive Huffman coding algorithms have been developed. The algorithm constructs the Huffman code based on the statistics of the symbols already encountered. In the next few class we will have a look at the design of adaptive Huffman code.

### 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

### Multimedia Communications. Huffman Coding

Multimedia Communications Huffman Coding 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

### 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 - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### Digital System Design Prof. D. Roychoudhury Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D. Roychoudhury Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 03 Digital Logic - I Today, we will start discussing on Digital

### 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

### 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

### 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

### Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

### Section 1.4 Place Value Systems of Numeration in Other Bases

Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

### 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

### Recall that in base 10, the digits of a number are just coefficients of powers of the base (10):

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### 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

### NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### 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

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### (Refer Slide Time: 1:41)

Discrete Mathematical Structures Dr. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture # 10 Sets Today we shall learn about sets. You must

### 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.

### 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

### NUMBER SYSTEMS CHAPTER 19-1

NUMBER SYSTEMS 19.1 The Decimal System 19. The Binary System 19.3 Converting between Binary and Decimal Integers Fractions 19.4 Hexadecimal Notation 19.5 Key Terms and Problems CHAPTER 19-1 19- CHAPTER

### 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

### A Basic Course in Real Analysis Prof. P. D. Srivastava Department of Mathematics Indian Institute of Technology, Kharagpur

A Basic Course in Real Analysis Prof. P. D. Srivastava Department of Mathematics Indian Institute of Technology, Kharagpur Lecture - 3 Continuum and Exercises So the last lecture we have discussed the

### 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:

### 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,

### Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

### 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

### 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

### 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

### Programming and Data Structure

Programming and Data Structure Dr. P.P.Chakraborty Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture # 07 Data Structuring: Case Study - III We shall continue

### Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

### 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

### Number System. Some important number systems are as follows. Decimal number system Binary number system Octal number system Hexadecimal number system

Number System When we type some letters or words, the computer translates them in numbers as computers can understand only numbers. A computer can understand positional number system where there are only

### Chapter 2 Numeric Representation.

Chapter 2 Numeric Representation. Most of the things we encounter in the world around us are analog; they don t just take on one of two values. How then can they be represented digitally? The key is that

### 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

### 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

### Number Systems and. Data Representation

Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

### Integer multiplication

Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B

### Automata and Languages

Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful

### 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

### Data Representation in Computers

Chapter 3 Data Representation in Computers After studying this chapter the student will be able to: *Learn about binary, octal, decimal and hexadecimal number systems *Learn conversions between two different

### CHAPTER 1 BINARY SYSTEM

STUDENT COPY DIGITAL & MICROPROCESSORS 3 CHAPTER 1 BINARY SYSTEM Base Conversion: A number a n, a n 1 a 2, a 1 a 0 a 1 a 2 a 3 expressed in a base r system has coefficient multiplied by powers of r. n

### Data Representation Binary Numbers

Data Representation Binary Numbers Integer Conversion Between Decimal and Binary Bases Task accomplished by Repeated division of decimal number by 2 (integer part of decimal number) Repeated multiplication

### Positional Numbering System

APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

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

### Symbol Tables. Introduction

Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The

### Number Systems and Base Conversions

Number Systems and Base Conversions As you know, the number system that we commonly use is the decimal or base- 10 number system. That system has 10 digits, 0 through 9. While it's very convenient for

### A Short Introduction to Binary Numbers

A Short Introduction to Binary Numbers Brian J. Shelburne Department of Mathematics and Computer Science Wittenberg University 0. Introduction The development of the computer was driven by the need to

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### The largest has a 0 in the sign position and 0's in all other positions:

10.2 Sign Magnitude Representation Sign Magnitude is straight-forward method for representing both positive and negative integers. It uses the most significant digit of the digit string to indicate the

### 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

### (Refer Slide Time: 2:03)

Control Engineering Prof. Madan Gopal Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 11 Models of Industrial Control Devices and Systems (Contd.) Last time we were

### 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

### Basic Electronics Prof. Dr. Chitralekha Mahanta Department of Electronic and Communication Engineering Indian Institute of Technology, Guwahati

Basic Electronics Prof. Dr. Chitralekha Mahanta Department of Electronic and Communication Engineering Indian Institute of Technology, Guwahati Module -5 Power Circuits and System Lecture - 2 Transformer

### Balanced search trees

Lecture 8 Balanced search trees 8.1 Overview In this lecture we discuss search trees as a method for storing data in a way that supports fast insert, lookup, and delete operations. (Data structures handling

### Chapter 4: Computer Codes

Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

### CSC 1103: Digital Logic. Lecture Six: Data Representation

CSC 1103: Digital Logic Lecture Six: Data Representation Martin Ngobye mngobye@must.ac.ug Mbarara University of Science and Technology MAN (MUST) CSC 1103 1 / 32 Outline 1 Digital Computers 2 Number Systems

### CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

### (Refer Slide Time: 00:01:16 min)

Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### Number Representation and Arithmetic in Various Numeral Systems

1 Number Representation and Arithmetic in Various Numeral Systems Computer Organization and Assembly Language Programming 203.8002 Adapted by Yousef Shajrawi, licensed by Huong Nguyen under the Creative

### 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...

### Number Systems I. CIS008-2 Logic and Foundations of Mathematics. David Goodwin. 11:00, Tuesday 18 th October

Number Systems I CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 18 th October 2011 Outline 1 Number systems Numbers Natural numbers Integers Rational

### 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 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

### CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

### 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

### 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

Trees and Binary Relations Debdeep Mukhopadhyay IIT Madras Outline Tree : definition and its relation with binary relations Properties Expressions: Balancedness Infix, Postfix and Prefix Expression Trees

### 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

### 6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

### 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

### Unit 2: Number Systems, Codes and Logic Functions

Unit 2: Number Systems, Codes and Logic Functions Introduction A digital computer manipulates discrete elements of data and that these elements are represented in the binary forms. Operands used for calculations

### Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 9 Basic Scheduling with A-O-A Networks Today we are going to be talking

### Basic Math Vocabulary

Basic Math Vocabulary 1) about not an exact answer Examples: 4.9 is about 5, \$3.02 is about \$3.00. 2) afford how much money you can pay for something Example: I can afford to spend \$25 on dinner tonight,

### Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

### 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.

### MA2C03 Mathematics School of Mathematics, Trinity College Hilary Term 2016 Lecture 59 (April 1, 2016) David R. Wilkins

MA2C03 Mathematics School of Mathematics, Trinity College Hilary Term 2016 Lecture 59 (April 1, 2016) David R. Wilkins The RSA encryption scheme works as follows. In order to establish the necessary public

### 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

### Advanced Engineering Mathematics Prof. Jitendra Kumar Department of Mathematics Indian Institute of Technology, Kharagpur

Advanced Engineering Mathematics Prof. Jitendra Kumar Department of Mathematics Indian Institute of Technology, Kharagpur Lecture No. # 28 Fourier Series (Contd.) Welcome back to the lecture on Fourier

### FRACTIONS 1 MANIPULATING FRACTIONS. the denominator represents the kind of pieces the whole has been divided into

CONNECT: Fractions FRACTIONS 1 MANIPULATING FRACTIONS Firstly, let s think about what a fraction is. 1. One way to look at a fraction is as part of a whole. Fractions consist of a numerator and a denominator:

### Advanced 3G and 4G Wireless Communication Prof. Aditya K. Jagannatham Department of Electrical Engineering Indian Institute of Technology, Kanpur

Advanced 3G and 4G Wireless Communication Prof. Aditya K. Jagannatham Department of Electrical Engineering Indian Institute of Technology, Kanpur Lecture - 3 Rayleigh Fading and BER of Wired Communication

### Binary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University

Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent

### Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

Today s topics! Binary Numbers! Brookshear.-.! Slides from Prof. Marti Hearst of UC Berkeley SIMS! Upcoming! Networks Interactive Introduction to Graph Theory http://www.utm.edu/cgi-bin/caldwell/tutor/departments/math/graph/intro

### Bits, Data Types, and Operations. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

Bits, Data Types, and Operations University of Texas at Austin CS3H - Computer Organization Spring 2 Don Fussell How do we represent data in a computer? At the lowest level, a computer is an electronic

### Problem Set I Lossless Coding

Problem Set I Lossless Coding Christopher Tsai Problem #2 Markov- Source Model The two-dimensional entropy rate function, is, Problem 2[ii] - Entropy Rate Function of a Markov- Source.9 Entropy H(α, β).9.7.3..7.3

### 1 Basic Computing Concepts (4) Data Representations

1 Basic Computing Concepts (4) Data Representations The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The

### Chapter 3: Number Systems

Slide 1/40 Learning Objectives In this chapter you will learn about: Non-positional number system Positional number system Decimal number system Binary number system Octal number system Hexadecimal number

### Lecture No. # 02 Prologue-Part 2

Advanced Matrix Theory and Linear Algebra for Engineers Prof. R.Vittal Rao Center for Electronics Design and Technology Indian Institute of Science, Bangalore Lecture No. # 02 Prologue-Part 2 In the last

### The Decimal System. Numbering Systems. The Decimal System. The base-n System. Consider value 234, there are: Ver. 1.4

2 The Decimal System Numbering Systems 2010 - Claudio Fornaro Ver. 1.4 Consider value 234, there are: 2 hundreds 3 tens 4 units that is: 2 x 100 + 3 x 10 + 4 x 1 but 100, 10, and 1 are all powers of 10

### CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

### = Chapter 1. The Binary Number System. 1.1 Why Binary?

Chapter The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base-0 system. When you

### 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

### COMPUTER ARCHITECTURE IT0205

COMPUTER ARCHITECTURE IT0205 M.Thenmozhi/Kayalvizhi Jayavel/M.B.Panbu Asst.Prof.(Sr.G)/Asst.Prof.(Sr.G)/Asst.Prof.(O.G) Department of IT SRM University, Kattankulathur 1 Disclaimer The contents of the