Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Longest Non-Overlapping Substring

I wonder if anyone knows the (optimal?) algorithm for longest recurring non-overlapping sub string.

For example, in the string

ABADZEDGBADEZ

the longest recurring would be "BAD". Incidentally if there is no such result, the algorithm should alert that such a thing has occurred. My guess is that this involves suffix trees.

I'm sure this must exist somewhere already. Thanks for the help!

like image 510
Brandon Pelfrey Avatar asked Aug 24 '09 17:08

Brandon Pelfrey


1 Answers

Suffix array is a good data structure for solving that problem.

There is a solution to this problem in Programming Pearls by Jon Bentley.

like image 140
Nick Dandoulakis Avatar answered Sep 24 '22 10:09

Nick Dandoulakis