Click to See Complete Forum and Search --> : Text-shrinking algorithm using dynamic programming


danooo
April 9th, 2008, 06:27 PM
Hi,

I am new to this forum and I desperately need an idea of how to solve the following task:

"Write an algorithm which shriks an input string of characters. The shrinking operation consists of replacing a substring "sub" repeated k-times with the following string: k[sub]. The output string has to be the SHORTEST string possible. I should use dynamic programming"

example of an input: "daaaaaaabcaaaaaaabc"
output: "d2[7[a]bc]"

As I said, I am desperated. The biggest hitch is that the resulting string has to be the shortest possible. I tried to think of an idea of how the algorithm should work but i wasn't successful. Most of the ressources I found on the web focus on compression, Huffmal, Ziv-Lempel codes or LCS.

Please help!

prometheuzz
April 10th, 2008, 08:30 AM
People who are going to answer can also look at:
http://forum.java.sun.com/thread.jspa?messageID=10197776
for extra information.

@OP: When cross posting, please say you're doing so, otherwise you might be wasting people's time.

Thanks.

danooo
April 10th, 2008, 09:00 AM
prometheuzz: Thanks for advice. I`ll focus solely on the java forum than.