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

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

What is the best way to match a string or part of a string in C language ? It could be whole string or such as "develop" took from "development". I used to solve this problem with some loops, but it getting TLE for large size in Length. Which way would be efficient ?

Thanks

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

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

KMP (Knuth-Morris-Pratt algorithm) and Rabin-Karp algorithm.

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

I have once got AC with just strstr function in the problem where KMP was expected. Try it out.