I have a task... And idea- and don't know how to implement it.

So, we need to create a set of integers of 100 000 elements (keys) and a range of 50 000 integers (hash-table). The keys are natural numbers from 1 to 100 thousand. Make your own hash function. The idea of the task is suitable for placing the keys in the hash table until it has a place, and then it stops putting the keys, where the index element in the hash table determines the hash function. If you want to take the place of either the collision. This collision is necessary to calculate and print them on the screen as the only output data. The best hash function = minimum number "crashing"

My idea for Hash table is:

Code:int hash (int x) { return (x - 1) % 50000; }

And have a problem to write this in the arrear of code... Can anyone solve my problem and write it?

Thanx a lot,

Marie