[clug] Substring repetition detection

Michael Still mikal at stillhq.com
Wed Jun 25 16:02:50 EST 2003


[ Before anyone asks, this isn't my school home work ]

Imagine I have a string:

abcdefghdefghdefghijk

I would like an algorithm to turn this into

a
b
c
defgh * 3
i
j
k

In other words, I'm interested in an algorithm which can detect repetitive
substrings. The repetitions are always consecutive (otherwise I don't
care). The repetitions can however be of varying length.

Anyways, I can't think of a good answer. Any hints?

Thanks,
Mikal

-- 

Michael Still (mikal at stillhq.com) | Stage 1: Steal underpants
http://www.stillhq.com            | Stage 2: ????
UTC + 10                          | Stage 3: Profit





More information about the linux mailing list