NEED HELP IN HASHING

Revision en2, by javacoder1, 2015-11-18 13:47:50

I was trying to solve a question through hashing.When I used ll P1=1000000009,M1=1000001011 where i converted the string into P1 based number system and took modulo by M1 i got wrong answer on test 14 but the same code replaced with ll P1=257,M1=1000000007 passes the system tests. I know that the wrong answer would be because of collision So my question is how to know of what values to hash from before solving a question.Are there any set of values which give better performance in certain type type of questions? (ll means long long)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English javacoder1 2015-11-18 13:47:50 21 Tiny change: 'questions?' -> 'questions? (ll means long long)'
en1 English javacoder1 2015-11-18 13:47:05 538 Initial revision (published)