prime number in hashing

why do we only choose prime numbers while using modulo operation during rabinkarp or similar algorithms?? can anyone explain with an example where a prime number has an advantage over others?

Hi @amit09, to know the answer I would rather suggest to go through these:

this and that :slight_smile:

Because you will get this thing the best when you read yourself and do a bit of research. Good luck.

1 Like