Run Length Encoding It is sometimes important to minimise the space used for storing data. This idea...

80.2K

Verified Solution

Question

Programming

Run Length Encoding

It is sometimes important to minimise the space used for storingdata. This idea of data compression can be implemented in manyforms. One of the simpler techniques is known as Run LengthEncoding (RLE). RLE takes advantage of the fact that in many cases,data will contain a run of repeated 0s or 1s, and these runs can berepresented by a shorter code. RLE is a technique used in someimage or sound formats to reduce the overall size of the file.There are many variations of this process, but for this assignment,you will use the 3-bit encoding version described below.

  1. Given binary data represented by a sequence of 0s and 1s, breakthe number into runs of 0s and 1s and note the length of eachrun.
  2. For any run of more than 7, break the run into groups of 7 orsmaller.
  3. For each run, create an encoded form by first placing the typeof run 0 or 1 and then the binary representation of the run’slength.
  4. Write out the encoded form of data by taking each encoded runand separating them with spaces. Be sure to keep the original orderof the data intact.

Example:

Given 11111000000010000001111111000000, what is the RLE form ofthis data?

Breaking this into runs gives us 5 1s, 7 0s, 1 1s, 6 0s, 7 1s, 60s

For each group, combine the type of run followed by the lengthin binary. Use spaces to separate each run:

1101 0111 1001 0110 1111 0110 is the RLE form.

Data Compression

Data compression is the ratio of the compressed data over theuncompressed data. In this case, the compressed data is 24 bits(including the spaces, which must be counted), and the originaldata is 32 bits. This gives a data compression ratio of 0.75.

Question 1a: What is the RLE of thefollowing?

1111100000000000

Question 1b:

What is the compression ratio for the answer to Question 1a?

Question 2a: What is the RLE of thefollowing?

101010

Question 2b:

What is the compression ratio for the answer to Question 2a?

Could you please help with these questions with enoughexplanation?

Thanks a lot

Answer & Explanation Solved by verified expert
3.9 Ratings (549 Votes)
NOTE In the example given in the question the RLE 1101 01111001 0110 1111 0110 length is calculated as 24bits with spacesincluded which is wrong it should be 24bits with space excluded and29bits with space includedI have calculated the compression ratiowith both space included and excludedIf you find the answer helpful please give a thumps upNOTEIn this question it is given to use binary equivalent to 3size onlyFirst you need to know how to covert any decimal number tobinary numberDivide the number by 2Get the integer quotient for the next iterationGet the remainder for the binary digitRepeat the steps until the quotient is equal to 0Question 1a What is the RLE of the following1111100000000000Answer 1aStep 1 Breaking the data in the runs of 1s and 0s oflength less or equal to 7Now the data has been broken down in    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students