Question: Python Question: Design and implement encoder and decoder functions that perform run length compression of strings (https://en.wikipedia.org/wiki/Run-length_encoding). a. Run length string encoder: The encoder function
Python Question:
Design and implement encoder and decoder functions that perform run length compression of strings (https://en.wikipedia.org/wiki/Run-length_encoding).
a. Run length string encoder: The encoder function should take a string as a parameter, and return the encoded string, represented in a list.
For example:
Given the string: aadccccaa
The encoded string will be: [[a, 2], [d, 1], [c, 4], [a, 2]].
b. Run length string decoder: The decoder function should take an encoded string (represented in a list) as a parameter, and return the original string.
For example:
Given the encoded string: [[a, 2], [d, 1], [c, 4], [a, 2]]
The decoded string is: aadccccaa.
Note: Use the top down design approach to break the problem into smaller sub-problems that can be used to solve it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
