Question: Consider the following string compression problem. We are given a dictionary of m strings,each of length at most k. We want to encode a data
Consider the following string compression problem. We are given a dictionary of m strings,each of length at most k. We want to encode a data string of length n using as few dictionary strings as possible. For example, if the data string is bababbaababa and the dictionary is (a,ba,abab,b), the best encoding is (b,abab,ba,abab,a). Give an O(nmk) algorithm to nd the length of the best encoding or return an appropriate answer if no encoding exists.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
