Hey,
I asked this question a little while back, and got a working solution with the conventional way... Which is, building a table and looking at a diagonal sequence of numbers. But, I was wondering if it was possible to do it using a constant amount of memory.. as in, without the table. Is that even possible?
The only way I can think of doing it is, take the shorter string of the 2, chop it up into all possible substrings, and then see if any of the substrings exist in the bigger of the 2 strings... but this method would take an enormous amount of time...
Is there a slightly more efficient method? Google searches return methods that use a constant time, but not constant memory...
Appreciate any help on this!
When building a suffix tree, multiple occurences of a substring in a text are caught and recorded. If the two input strings are concatentated (with you keeping track of the demarcation), then as you build the suffix tree from your two strings, then whenever a substring matches that is in both input strings, you keep track of the largest occurrence.