Question
Problem 6a rle.py : Run length compression [10 points] Write a function rle() that takes a list as input and returns another list with its
Problem 6a rle.py: Run length compression [10 points] Write a function rle() that takes a list as input and returns another list with its run length encoding. As always, the input list should not be modified in any way.
Problem 6b rle.py: Run length decompression [10 points] Write a function unrle() that takes the run length encoding as input and returns the original list. This is the inverse of the previous function (i.e., for anylistl,itsalwaystruethatunrle(rle(l)) == l).Onceagain,theinputlistshouldnotbemodifiedinany way.
Note: You can assume that all values in the encoding are immutable (i.e., you do not need to worry about making copies of the value component of each run).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started