If input string is ended in a whole repetition (so there is no
auxilary end of the repeated string, e.g. aabab - OK, aaba - NO),
then use binary search + calculatin of prefix function (refer to the
KMP).
Also you may find useful idea of most repeated substring in a string
(which has linear complexity).

On Nov 9, 9:16 pm, Xu Wang <wangxu.n...@gmail.com> wrote:
> Hi, everyone,
>
> I wonder is there an algorithm to determine a string is looping. For
> example,
>
> s = 'aabcacbdbdbdacbdbdbdacbdbdbdacbdbdbdac....'
>
> Obviously, s is looping with the substring 'acbdbdbd'. It is easy to
> see s is looping if we know the substring, but I have no idea about if
> we do no know the substring.
>
> The information we have is s is looping with a substring, whose length
> is greater than a specific value, e.g., the value is 3 for the
> example. Another thing is that, we don't know when s starts to loop,
> so is it able to have an efficient condition of the length of s we
> need to determine the looping of s.
>
> Thanks.
>
> Xu

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to