Question: Run Length Encoding in Prolog Run Length Enconding ( RLE ) is a compression technique used in areas such as image compression ( e .
Run Length Encoding in Prolog
Run Length Enconding RLE is a compression technique used in areas such as image compression eg GIFs It compresses runs of identical pieces of information in this case singlecharacter atoms and records how many times they appear in a list in a consecutive run. For example, the list:
aaabbcaa
will get encoded to:
abca
Write a predicate myencode that takes the uncompressed list as a first parameter and returns the compressed list as shown as the second parameter. For example:
myencodeX should yield X
myencodeabbcccddX should yield X abcd
myencodeappleX should yield X aple
Hint:
You may find it useful to write a tempencode function that translates a list like
aaabbcaa
into
aaabbcaa
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
