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

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

How to find all occurences of each substring in the given string.Please give me some suggestions

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

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

you can easily make that in O(N*N*N) time using Brute force. Then using hashes it can be reduced to O(N*N). You cAn make that in O(N*N) using KMP.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Z-Function.

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

If I understood the problem correctly, then using suffix array + lcp should give performance between O(N) and depending on chosen algorithm for searching suffix array.