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

Автор pksingh290, история, 4 года назад, По-английски

I need your help guys.i am struggling to learn hashing and KMP especially its implementation part . i am not getting problems with sollutions or good explainations. i need some good resource so it will really be appreciated if anyone can provide me with the same .

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

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

The competitive programmers handbook explains it well: https://cses.fi/book/book.pdf

A modification is: You should hash with two prime moduli (1e9 + 7 and 1e9 + 9 worked for me) as one modulus is not enough to prevent collisions.

Maybe there are more precautions that I am too inexperienced to know about.

The only time I used string hashing was to solve this problem: https://codeforces.com/problemset/problem/271/D

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

I will suggest you these two Links for getting familiar with KMP This Video and Brlliant.org

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

CP-Algorithms has a nice article on string hashing: https://cp-algorithms.com/string/string-hashing.html

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    CP-Algorithms explanation about KMP is also really nice. I like how they introduced step by step optimizations in the algorithm.