Computer Science: An Overview (12th Edition)
12th Edition
ISBN: 9780133760064
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 1, Problem 48CRP
Program Plan Intro
LZW Compression:
LZW is a dictionary based compression
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Convert the following numbers into base ten.
(a)
32five
(b)
22six
(c)
410five
(d)
3203five
(e)
202five
(f)
1222six
(g)
202four
(h)
404seven
(i)
1000two
(j)
11011two
(k)
88sixteen
(l)
707sixteen ?
3 Counting k-inversions
A k-inversion in a bitstring b is when a 1 in the bitstring appears k indices before a 0; that
is, when b; = 1 and bi+k = 0, for some i. For example, the string 010010 has two 1-inversions
(starting at the second and fifth bits), one 2-inversion (starting at the second bit), and one
4-inversion (starting at the second bit).
Devise an algorithm which, given a bitstring b of length n, counts all the k-inversions, for
each k from 1 to n - 1. Your algorithm should run faster than (n²) time. You can assume
arithmetic on real numbers can be done in constant time.
Give a 3-part solution.
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…
Chapter 1 Solutions
Computer Science: An Overview (12th Edition)
Ch. 1.1 - What input bit patterns will cause the following...Ch. 1.1 - In the text, we claimed that placing a 1 on the...Ch. 1.1 - Assuming that both inputs to the flip-flop in...Ch. 1.1 - a. If the output of an AND gate is passed through...Ch. 1.1 - Prob. 5QECh. 1.1 - Prob. 6QECh. 1.2 - If the memory cell whose address is 5 contains the...Ch. 1.2 - Prob. 2QECh. 1.2 - How many bits would be in the memory of a computer...Ch. 1.3 - Prob. 1QE
Ch. 1.3 - Prob. 2QECh. 1.3 - Prob. 3QECh. 1.3 - Prob. 4QECh. 1.3 - Prob. 5QECh. 1.3 - Prob. 6QECh. 1.4 - Here is a message encoded in ASCII using 8 bits...Ch. 1.4 - In the ASCII code, what is the relationship...Ch. 1.4 - Prob. 3QECh. 1.4 - Prob. 4QECh. 1.4 - Convert each of the following binary...Ch. 1.4 - Prob. 6QECh. 1.4 - What is the largest numeric value that could be...Ch. 1.4 - An alternative to hexadecimal notation for...Ch. 1.4 - What is an advantage of representing images via...Ch. 1.4 - Prob. 10QECh. 1.5 - Convert each of the following binary...Ch. 1.5 - Convert each of the following base ten...Ch. 1.5 - Convert each of the following binary...Ch. 1.5 - Express the following values in binary notation:...Ch. 1.5 - Perform the following additions in binary...Ch. 1.6 - Convert each of the following twos complement...Ch. 1.6 - Prob. 2QECh. 1.6 - Suppose the following bit patterns represent...Ch. 1.6 - Suppose a machine stores numbers in twos...Ch. 1.6 - In the following problems, each bit pattern...Ch. 1.6 - Prob. 6QECh. 1.6 - Prob. 7QECh. 1.6 - Prob. 8QECh. 1.6 - Prob. 9QECh. 1.6 - Prob. 10QECh. 1.6 - Prob. 11QECh. 1.7 - Prob. 1QECh. 1.7 - Prob. 3QECh. 1.7 - Prob. 4QECh. 1.8 - What makes Python an interpreted programming...Ch. 1.8 - Write Python statements that print the following:...Ch. 1.8 - Write Python statements to make the following...Ch. 1.8 - Write a Python statement that given an existing...Ch. 1.9 - Prob. 1QECh. 1.9 - Prob. 2QECh. 1.9 - Prob. 3QECh. 1.9 - Prob. 4QECh. 1.9 - Prob. 5QECh. 1.9 - Prob. 6QECh. 1.9 - Prob. 7QECh. 1.10 - Prob. 1QECh. 1.10 - Could errors have occurred in a byte from Question...Ch. 1.10 - Prob. 3QECh. 1.10 - Prob. 4QECh. 1.10 - Prob. 5QECh. 1.10 - Prob. 6QECh. 1 - Determine the output of each of the following...Ch. 1 - a. What Boolean operation does the circuit...Ch. 1 - a. If we were to purchase a flip-flop circuit from...Ch. 1 - Assume that both of the inputs in the following...Ch. 1 - The following table represents the addresses and...Ch. 1 - How many cells can be in a computers main memory...Ch. 1 - Prob. 7CRPCh. 1 - Prob. 8CRPCh. 1 - Prob. 9CRPCh. 1 - Prob. 10CRPCh. 1 - Suppose a picture is represented on a display...Ch. 1 - Prob. 12CRPCh. 1 - Prob. 13CRPCh. 1 - If each sector on a magnetic disk contains 1024...Ch. 1 - How many bytes of storage space would be required...Ch. 1 - Prob. 16CRPCh. 1 - Prob. 17CRPCh. 1 - Suppose a typist could type 60 words per minute...Ch. 1 - Prob. 19CRPCh. 1 - Prob. 20CRPCh. 1 - Prob. 21CRPCh. 1 - Prob. 22CRPCh. 1 - Prob. 23CRPCh. 1 - Prob. 24CRPCh. 1 - Prob. 25CRPCh. 1 - Prob. 26CRPCh. 1 - Prob. 27CRPCh. 1 - Prob. 28CRPCh. 1 - Prob. 29CRPCh. 1 - Prob. 30CRPCh. 1 - Prob. 31CRPCh. 1 - Prob. 32CRPCh. 1 - Prob. 33CRPCh. 1 - Prob. 34CRPCh. 1 - Prob. 35CRPCh. 1 - Prob. 36CRPCh. 1 - Prob. 37CRPCh. 1 - Prob. 38CRPCh. 1 - Prob. 39CRPCh. 1 - Prob. 40CRPCh. 1 - Prob. 41CRPCh. 1 - Prob. 42CRPCh. 1 - Prob. 43CRPCh. 1 - Prob. 44CRPCh. 1 - Prob. 45CRPCh. 1 - What would be the hexadecimal representation of...Ch. 1 - Prob. 47CRPCh. 1 - Prob. 48CRPCh. 1 - Prob. 49CRPCh. 1 - Prob. 50CRPCh. 1 - Prob. 51CRPCh. 1 - Prob. 52CRPCh. 1 - Prob. 53CRPCh. 1 - Prob. 54CRPCh. 1 - Prob. 55CRPCh. 1 - Prob. 56CRPCh. 1 - Prob. 57CRPCh. 1 - Prob. 58CRPCh. 1 - Write and test a Python script that, given a...Ch. 1 - Prob. 61CRPCh. 1 - Prob. 2SICh. 1 - Prob. 3SICh. 1 - Prob. 4SICh. 1 - Prob. 5SICh. 1 - Prob. 6SICh. 1 - Prob. 7SI
Knowledge Booster
Similar questions
- 6-In the representation Complement to 1, we the number when Code the absolute value thus is negative: A = True B- False 7- The result in base 10' A - 44.25 B-42015 C- 51. 13 45. 75 8- The result AT 40. B + 61 q of the transformation (101001.10) 2 usi o the transformation (52) a in bose 10 is: C² 42 D-41 WWW 30 Oarrow_forward7. The normalized representation of 0.0010110 * 2 ^ 9 is a. 0 10001000 0010110 b. 0 10000101 0110 c. 0 10101010 1110 d. 0 11110100 11100arrow_forwardRGB is a color model that defines color by the combination of Red, Green, and Blue. An RGB tuple is composed of three numbers that specify the intensity of each color. Because it uses 8 bits (0s or 1s) for each color, each intensity can be transformed into a hexadecimal number with two digits at most. There are 256 possible shades for each color, since "11111111" (or hex "ff") corresponds to decimal 255, plus the number 000. The combination of all 256 possible shades for the three primary colors gives 256 cubed, or over 16 million possible colors. Write a function that takes a color in RGB or hex and returns the opposite. If it takes in the three integers in an RGB, it should return a string with the equivalent hexadecimal notation, plus a hash sign (#) at the front. If it takes in a string in hex, it should return an array with the three integers corresponding to RGB. Examples rgbHex (150, 50, 76) "#96324c" // 150 is hex 96, 50 is hex 32 and 76 is hex 4c. - rgbHex("#303749") → (48,…arrow_forward
- How many eight-bit binary strings contain exactly 3 1s? How many eight-bit binary strings contain at least three 1s? How many eight-bit binary strings contain an equal number of 0s and 1s? How many eight-bit binary strings contain at most three 1s?arrow_forwardAddition, Subtraction and Multiplication of BINARIES Solve the Following Binaries With Complete Solution : 1. 1100110011111 + 1111100001111 2. 1100110011111 - 1111100001111 3. 1100110011111 * 1111111111111arrow_forwardEvaluate the expression (11011∧01011)⊕(00001∨00111)arrow_forward
- Write down the binary representation of the decimal number 63.25 assuming it was stored using the single precision IBM format (base 16, instead of base 2, with 7 bits of exponent).arrow_forwardCreate a Huffman compression code for the phrase “Expecto Patronum” (ignoring character case). You answer should include your Huffman code tree (including clear illustration of it’s development) plus the resultant encoded phrase.arrow_forward- 2/2* الرمز الرمادي (10110111101) = () ' بالرقم العشري 931 1753 867 1877 لا احد منهم 1749 1750 869 22 (1100111) (11011001 ---arrow_forward
- Create a Huffman compression code for the phrase “Avada Kedavra” (ignoring character case). You answer should include your Huffman code tree (including clear illustration of it’s development) plus the resultant encoded phrase.arrow_forwardA2.JPG ... MOV SP, [BP+SI+ACBAH] A.JPG PHY. ADD PHY. ADD PHY. ADD PHY. ADD PHY. ADD D9855H 13H D9856H 24H D9857H| 35H D9858H 46H D9859H | 57H D985AH 68H D985BH 79H B8FAFH 05H В8FAЕН | 27Н DCCOAH 11H DCCOBH | 84н DCCOCH 52H DCCODH A1H DCCOЕH 27Н DCCOFH| 05H F6960H FEH E38E5H 13Н F695FH DCH F695EH | ВАН F695DH| 98H F695CH 76H E38E4H 24H Е38ЕЗН | 35Н E38E2H | 46H E38E1H 57H Е38EОН | 68Н E38DFH 79H B8FADH 87H B8FACH A1H B8FABH 52H B8FAAH 11H F695BH 54H F695АH | 32H B8FA9H 84H DCC10H | 87Нarrow_forwardThe bit exponent (characteristic) of the machine number 01100000111 010100110001 is Select one: a. 776 on b. 775 C. 774 d. 773 Previous page Nex Return to: General search DELLarrow_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