Find the longest recurring substring

0

0

Given a string of no more than 255 characters, find a function that returns the longest recurring substring. An example would be:

aabbacadeauaaabba

where the longest recurring sub-string is aabba. I would preffer the answer in C/C++ as they are the only languages I know. The algorithm should be as fast as possible.

Sherpinsky

Posted 2015-02-06T11:33:57.397

Reputation: 21

Question was closed 2015-02-06T13:13:00.050

1What is recurring string ? same characters ? Why is there a C++ language limitation ? – Optimizer – 2015-02-06T11:34:38.710

I know only C/C++, sorry, substring not string, a recurring substring is a substring that appears more than once. – Sherpinsky – 2015-02-06T11:36:37.527

Ah. It would probably be better to give out some examples. Also, this is PPCG so you need to have a winning criteria . Do you want the shortest code ? faster algorithm ? most popular code ? Also, language specific questions are frowned upon here, so it would be better if you can remove that restriction and just ask in the question that you are specifically looking for C++ answer – Optimizer – 2015-02-06T11:42:11.613

2Winning criteria please :) – Optimizer – 2015-02-06T11:45:52.330

Are overlapping occurrences counted as distinct? For example, in the string aabbaabba, is the substring aabba recurring? – Zgarb – 2015-02-06T11:53:12.363

yes //(stuff to fill the required characters) – Sherpinsky – 2015-02-06T11:54:47.100

This is close enough to Counting k-mers that I consider it a duplicate.

– Peter Taylor – 2015-02-06T12:32:02.260

No answers