pksingh290's blog

By pksingh290, history, 4 years ago, In English

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 .

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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.net/problemset/problem/271/D

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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