Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
Chapter 16.3, Problem 8E
Program Plan Intro
To show that in the given case Huffman coding is no more efficient than using ordinary 8-bit fixed-length code.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A certain picture is constructed of a matrix of dots of color which have been created by mixing 3 primary colors of ink,
where each ink color can have one of 320 different amounts (i.e. different intensities). If the picture has 106 x 106 dots
of color, then what is the minimum number of Bytes (in kB to one decimal place) it would take to store a digitized
image of this picture?
One method that can be used to compress text data is run length encoding (RLE). When RLE is used the compressed data can be represented as a set of character/frequency pairs. When the same character appears in consecutive locations in the original text it is replaced in the compressed text by a single instance of the character followed by a number indicating the number of consecutive instances of that character. Single instances of a character are represented by the character followed by the number 1.
Figure 9 and Figure 10 show examples of how text would be compressed using this method.
Figure 9
Original text: AAARRRRGGGHH
Compressed text: A 3 R 4 G 3 H 2
Figure 10
Original text: CUTLASSES
Compressed text: C 1 U 1 T 1 L 1 A 1 S 2 E 1 S 1
What you need to do
Task 1
Write a Python program that will perform the compression process described above. The program should display a suitable prompt asking the user to input the text to compress and then output the compressed text.
Task 2
Test…
Scenario: In a biased N-bit binary number system with bias B, positive and negative numbers are represented as their value plus the bias B. For example, for 5-bit numbers with a bias of 15, the number 0 is represented as 01111, 1 as 10000, and so forth. Biased number systems are sometimes used in floating point mathematics. Consider a biased 8-bit binary number system with a bias of 12710
Question: What is the representation and value of the most negative number?
Chapter 16 Solutions
Introduction to Algorithms
Ch. 16.1 - Prob. 1ECh. 16.1 - Prob. 2ECh. 16.1 - Prob. 3ECh. 16.1 - Prob. 4ECh. 16.1 - Prob. 5ECh. 16.2 - Prob. 1ECh. 16.2 - Prob. 2ECh. 16.2 - Prob. 3ECh. 16.2 - Prob. 4ECh. 16.2 - Prob. 5E
Ch. 16.2 - Prob. 6ECh. 16.2 - Prob. 7ECh. 16.3 - Prob. 1ECh. 16.3 - Prob. 2ECh. 16.3 - Prob. 3ECh. 16.3 - Prob. 4ECh. 16.3 - Prob. 5ECh. 16.3 - Prob. 6ECh. 16.3 - Prob. 7ECh. 16.3 - Prob. 8ECh. 16.3 - Prob. 9ECh. 16.4 - Prob. 1ECh. 16.4 - Prob. 2ECh. 16.4 - Prob. 3ECh. 16.4 - Prob. 4ECh. 16.4 - Prob. 5ECh. 16.5 - Prob. 1ECh. 16.5 - Prob. 2ECh. 16 - Prob. 1PCh. 16 - Prob. 2PCh. 16 - Prob. 3PCh. 16 - Prob. 4PCh. 16 - Prob. 5P
Knowledge Booster
Similar questions
- 2.7 This problem introduces a hash function similar in spirit to SHA that operates on letters instead of binary data. It is called the toy tetragraph hash (tth).8 Given a message consisting of a sequence of letters, tth produces a hash value consisting of four letters. First, tth divides the message into blocks of 16 letters, ignoring spaces, punctuation, and capitalization. If the message length is not divisible by 16, it is padded out with nulls. A four-number running total is maintained that starts out with the value (0, 0, 0, 0); this is input to a function, known as a compression function, for processing the first block. The compression function consists of two rounds. Round 1: Get the next block of text and arrange it as a row-wise 4x4 block of text and convert it to numbers (A=0, B=1), for example, for the block ABCDEFGHIJKLMNOP, we have 81 thank William K. Mason and The American Cryptogram Association for providing this example. A B C D 0 1 2 3 E F G H 4 6 7 5 8 9 10 11 I J K L…arrow_forwarda. Give an example of a value that can't be represented in 32-bit IEEE because it doesn't have a finite representation in binary. Explain (i.e. show that it doesn't have a finite representation). b. Give an example of a value that can't be represented in 32-bit IEEE because it's out of the range of values that can be represented in this format. Explain (i.e. show that this value is out of the range of expressible values of 32-bit IEEE 754).arrow_forwardWhat is the Huffman code for a string consisting entirely of letters from a two-character alphabet? Give an example of the most bits that might be utilised in a Huffman code for an N-character string whose characters are all from a two-character alphabet.arrow_forward
- Consider the binary BCH code of length 127 with intended distance 6 utilizing the binary field extension F 128 of size 128. What is the code's size, and can you guarantee a minimum distance?arrow_forwardLet a “binary code” be the set of all binary words, each consisting of 6 bits (i.e., 0 or 1 digits). For example, 001101 is a word in this code.arrow_forward9. Let the bit representations of sets A and B as following A= 1010101010 B 0000011111 find (A U B) – A O 1010100000 0000001010 1010111111 (000010101arrow_forward
- computer network 32. Given a binary data flow D as 10110, the bit pattern G as 10011, please calculate r CRC bits, i.e., R, such that is exactly divisible by G (mod 2).arrow_forwardImplement the following error detection and error correction algorithms using C programming for Hamming code. For Hamming codes, flip a bit in the data and implement the algorithm to correct the same on the receiver side.arrow_forwardSome microcomputers in the past used a binary floating-point format with 8 bits for the exponent e and1 bit for the sign ơ. The significand x contained 31 bits, 1arrow_forwardConsider a new floating point representation, which we will call here the CMPT215Float16 representation. The CMPT215Float16 representation follows the IEEE 754 binary floating point standard, but with smaller-sized fields for the exponent and fraction. In particular, CMPT215Float16 numbers have a 1-bit sign field, followed by a 7-bit exponent field (in biased notation, with a bias of only 63 because of the smaller size of this field), followed by an 8-bit fraction field. Give, in decimal, the quantity represented by the following CMPT215Float16 floating point value: 0100001110100000.arrow_forwardConsider the decimal number (-48.325). Write down binaryrepresentation of this number using the IEEE 745 single precision format. Clearly specify “Sign”, “Exponent” and “Mantissa” fields of the single precisionrepresentation.arrow_forwardAs the IEEE 754 floating point standard only allows finite number of floating pointrepresentations in its format, the density of such representations may not be evenly distributed.Consider a region of (0,2) and (100,102). Which region do you think contains morerepresentations of floating points? Explain your logic.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning