catalystgma's blog

By catalystgma, history, 16 months ago, In English

Hello,

I wanted to ask if anybody knows about a subquadratic time complexity algorithm for figuring out the longest square substring of a string $$$s$$$. (i.e. $$$tt = ?$$$ s.t $$$\exists \, u, v$$$ s.t $$$s = uttv$$$, $$$|t|$$$ is maximized)

For example, if:

  • s = mississippi, tt = ssissi or tt = ississ.

  • s = aaaaa, tt = aaaa.

  • s = bababooey, tt = baba.

  • s = foopoopoofoo, tt = poopoo.

The related problem is much better documented (Longest Square Subsequence).

Sorry if the answer is trivial/known. Thank you for your help.

  • Vote: I like it
  • +10
  • Vote: I do not like it

»
16 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Main-Lorentz algorithm can find all the square substrings (not only the longest) in $$$O(n \log n)$$$.