Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have question about Run Length Encoding and decoding in java. I have no idea to write next code from here. fat-1: Decodes a string

I have question about Run Length Encoding and decoding in java.

I have no idea to write next code from here.

image text in transcribedimage text in transcribedimage text in transcribed
fat-1: Decodes a string encoded using RLE encoding. Characters that have not been encoded in the first place need no decoding and are simply transferred to the output string. However, once a delimiter is discovered in the rle string (this part was encoded from the original), the next thing that follows should be a {possibly multiple digit) number and the character after that will be the character that is used in the expansion. For example, if the rle string was "b*8abe" and the delimiter was '*' then there will be 8 a's in the expansion, thus, "baaaaaaaabe". @param rle a string that contains the RLE encoding of a picture @param delimiter the character that signals the next series of characters need to be decoded @returns the decoded string */ private static String decodeRLEtString rle, char delimiter) and x\" Outputs an uncompressed RLE string row-by-row onto the console, where the width of all rows is specified by the width parameter. The final row may be shorter than the specified width. @param decodedRLECode an uncompressed RLE string @param width the number of characters in one row of the final picture */ private static void printPicturetString decodedRLECoder int width] Samples: RLE Code = "^5. ^4. *...* *. * * * 64*45*" Delimiter = \\^/ Width = 5 Should result in the following picture: * * * 7* * * * * * * * But the same RLE Code and delimiter with a width of 10 should yield: And the same RLE Code and delimiter with a width of 4 should yield: * * * * * * *The Problem Create a program that will print out \"character pictures\" based on their Run Length Encoding (RLE). RLE is one of many ways of compressing a picture (or a text message or DNA sequences) so it takes up less space in a computer. For example, if the encoded RLE string was MACE)" Qbaa then the original string would have been AAACDbbbbaa . The " (in this case) is the RLE delimiter and indicates that encoding has occurred. The number is how many of the following character should he outputted. In this example, AAA, C and D were not encoded in the rst place as it would not have resulted in any space savings. The bbbh was replaced by *4h with a 25% savings on that portion only. Another RLE code example could be: Print this *15= . which would become Print this =============== . The delimiter itself can differ from one picture to the next. The RLE encoding MACD'baa would also produce the same original string, if the delimiter were ". Furthermore, if the delimiter were A, then " 4 * " 3b\" '3' Sr produces * * * *bhb&&& & a & a. Note: Digits themselves are a hit of a problem in this model and cannot be encoded. For example, if the encoding were * 52 3 , then it could mean 52 threes or 5 twos followed by a 3 or 523 commas! To remove this ambiguity, digits are not encoded at all and will not be the repetition character. There should be at least two methods in your solution dened as follows

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Discuss the techniques of sales forecasting.

Answered: 1 week ago

Question

Write short notes on Marketing mix.

Answered: 1 week ago