I am not sure this is what the instructions says.. I am totally lost.
Each of these entries must be stored inthe first 512 indices of a vector<string>.The identier determines which index the last name is stored. For this program, the index is determined by the hash function described in the introduction instead of the identier value. Collisions must be handled by incrementing the hash key until an unoccupied index is found. A function hash must be declared and used in the program with the following prototype.
( number % m ) is the integer remainder when number is divided by m.
The possible remainders are 0 to m-1.
When m is evenly divisible by m, ie, number = m*i for some integer i, then the remainder is 0, and so number % (m + 1) will then be 1.
If number mod m maps integers to values between 0 and m-1, what does this tell you about how you can map the numbers in your problem to values in the range of the your valid indices?
do not store the hash number. The hash is the index where you stored the data. Since the hash can be calculated, it makes finding the data much quicker than scanning through the entire container. So, what happens if 2 pieces of data have the same value? Well, they both can't be stored in the same place! The instructions clearly state that you find the next available index to store the data in.