Блог пользователя mobit

Автор mobit, 11 лет назад, По-английски

Hi , I have been thinking a lot but I haven't had any good idea about this , so I want your help : We are given an integer N and N strings , how could we find the longest common substring of them and the length of longest common substring of them ?

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

»
11 лет назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Build a generalized suffix array. Then for each inclusion-minimal window that contains a suffix from all the N strings, an answer candidate is the LCP of all of them. You can use two pointers and a set data structure to find all such inclusion-minimal windows. The runtime is expected linear if you use hash tables and a fast suffix array construction.