Hash function given:
public int hash4(int k) {
Random rand = new Random(k);
return rand.nextInt(size);
}
The goal is to find n(size) number of keys(k) that use this hash function to hash to the same hash value (cause collisions). The max value that a key can be is n^2 and you cannot just use the same key over and over. I have noticed if n is a power of two, all keys hash to the same value, but that does not help me. Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire