Computer Science Illuminated
Computer Science Illuminated
7th Edition
ISBN: 9781284155617
Author: Nell Dale, John Lewis
Publisher: Jones & Bartlett Learning
Expert Solution & Answer
Book Icon
Chapter 3, Problem 51E

Explanation of Solution

Data Compression using Run-length encoding:

Given string: “AAAABBBCCCCCCCCDDDD hi there EEEEEEEEEFF”

  • Data compression starts with flag character “*”.
  • It replaces a string containing sequence of repeated character.
  • Followed by a flag character, remaining characters in a string are encoded as follows,
    • The string “AAAA” is compressed as “A4” where numeric digit “4” indicates that the character “A” is repeated four times in a string.
    • The string “CCCCCCCC” is compressed as “C8” where numeric digit “8” indicates that the character “C” is repeated eight times in a string...

Explanation of Solution

Compression ratio in Run-length encoding:

  • Compression ratio is defined as the length of encoded sting is divided by the length of original string.
  • Formula to compute the compression ratio,

Compression ratio=Length of the encoded stringLength of theoriginal string

  • The length of original string “AAAABBBCCCCCCCCDDDD hi there EEEEEEEEEFF” is 40.
  • The length of compressed string “*A4BBB*C8*D4 hi there *E9FF” is 27

Blurred answer
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education