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 32.2, Problem 4E
Program Plan Intro
To prove that there is at most one chance in 1000 that
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
2. If we ignore the audio data in a video file, a video file is just a collection of many individual frames (i.e., images). What is the main reason that a video file can achieve a much higher compression ratio than a file that contains a single image file?
Using Huffman code, we can compress the bits used for saving the characters in a file:
(The Table is in Image Attachment)
Total bits used for saving the character in table 1 is 264 bits using standard ASCII 8 bits for 1 character.Using Huffman code encoding in Table 2, the total bits used is 126 bits.
The problem:➢ Input: list of characters such as table 1➢ Output: total bits using Huffman code encoding (table 2)➢ Task: Design an algorithm in pseudocode/code to print the total bits using Huffman codeencoding and write down the Algorithm analysis. The complexity of the algorithm must be inO(n) and proof it!➢ PS: you don’t need to sort the input since the input is already sorted!
Computer Science
(a) Let A = (Q,Σ,δ,q0,F) be a DFA.Formally describe a 2-tape TM with 3 states that accepts L(A).
(b) Let M = (Q, Σ, Γ, δ, q0, qa, qr) be a single-tape TM.Formally describe a 2-tape TM with 3 states that accepts L(M).
Knowledge Booster
Similar questions
- Consider the binary code C= {00100,10101,11110,01011}. What is d(C)arrow_forwardNext time you snap a picture, you realize you are capturing millions of pixels into a buffer. The buffer data is read and converted into JPEG in real time. Each pixel in that buffer is an unsigned int (four bytes ): Alpha, Blue, Green, and Red. Let us ignore alpha for now. As you know, a unsigned byte can have a value 0 to 255. In remote sensing jargons, it is called blue channel, green channel, and red channel. Each channel provides valuable information such as, say farm lands, forest fire, drought, landscape, diseases , If a pixel has a value (say in hex) = 0x00a1b1c1 , then 0xc1 is the red pixel, 0xb1 is the green pixel, 0xa1 is the blue and 00 is the alpha. #define RED 1 #define GREEN 2 #define BLUE 3 then, develop a function void calculateSum ( unsigned int *ptr , int count , unsigned char channel , unsigned int *sum, float *average ) { *sum = 0; if (channel == RED ) calculate sum and average for red channel else if (channel == GREEN )…arrow_forwardConsider an 8-bit variable that we want to use for storing real numbers. We decided touse 3 bits for storing the fractional part of the number. What are the minimum andmaximum values that we can store this way. What is the numerical error when storingvalue −7.6?arrow_forward
- A certain disk can read data at a rate of 515.2 MB/s. How many books can be read in 4 seconds if an "average" book has69 pages,20 lines per page,9 words per line,6 characters per word,and each character is one of 100 different characters where the fewest number of bits are used to represent each character?arrow_forwardlet S: r1(x);r2(x);w1(x):r1(x);w2(x);w1(y). Schedule S is said to be Select one: a. no serial and no serializable b. no serial and serializable C. serial d. none of the abovearrow_forwardUsing Huffman code, we can compress the bits used for saving the characters in a file: Total bits used for saving the character in table 1 is 264 bits using standard ASCII 8 bits for 1 character. Using Huffman code encoding in Table 2, the total bits used is 126 bits. The problem: ➢ Input: list of characters such as table 1 ➢ Output: total bits using Huffman code encoding (table 2) ➢ Task: Design an algorithm in pseudocode/code to print the total bits using Huffman code encoding and write down the Algorithm analysis. The complexity of the algorithm must be in O(n) and proof it! ➢ PS: you don’t need to sort the input since the input is already sorted!arrow_forward
- You are given a text file of size 60 MB, which is to be encrypted using steganography in the low-order bits of each color in an image file. What size image would be required in order to encrypt the entire file? What size would be needed if the file were first compressed to a third of its original size? Give your answer in pixels, and show your calculations. Assume that the images have an aspect ratio of 3:2, for example, 3000 × 2000 pixels.arrow_forwardRefer to the ASCII code file provided in the Resources or find an ASCII table on the Internet. 1. How will the following phone number look like stored in the computer storage in ASCII code? 315-265-1918 a. in decimal b. in hexadecimal 2. What is the largest unsigned integer that fits in a 4-bit word? Show how you determine it. 3. What is the largest unsigned integer that fits in an 8-bit word? Show how you determine it. 4. Find out what is the meaning of the term OVERFLOW when a computer adds integers (with the same sign - both positive or both negative). Cite your source.arrow_forwardIn MATLAB, a grey-scale image is stored a a matrix of numbers, all between 0 (black) and 255 (white). Since there are 256 possible values, 8 bits are needed or each pixel, in contrast to a normal integer, which is 64 bits.To save memory, grey-scale images are stored with a special data type, uint8 (unsigned 8-bit integer). In computer terminology, 8 bits = 1 byte. Even at one byte per pixel, a large image can consume a lot of memory. For example, a 1000x1000-pixel image takes 1 million bytes (which is a little less than 1 megabyte, since by convention 1 Mbyte = 2^20 bytes). One technique for reducing the size of an image is quantization - reducing the number of allowable levels from 256 to something smaller. Surprisingly, most images can be quantized by a large factor without losing much information. In this problem, you will quantize a grey-scale image to only 4 levels, so that it could (in principle) be stored as 2 bits per pixel. The template will read in an image file. Your job…arrow_forward
- 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…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_forward1. two digits 8 & 3, Convert it to a 7-bit binary number (83 → 0010111) 3. Do the analysis of state-tape contents as in diagram (*) in ex.1 for a task of generating parity bit for the number. For the example, initial tape contents should be ΦΦ0010111Φ, and the parity bit is then 0 → final contents on the tape is Φ00010111Φarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education