Bad Hash Function

0

I am confused about the hash function. This is a good hash function

private int hash(K key) {
    return (key.hashCode() & 0x7fffffff) % M;
    }

How would I turn that into a very bad hash function, would it be like this?

private int hash(K key) {
    return (key.hashCode() & 17) % M;
    }
java
asked on Stack Overflow Oct 25, 2020 by C G

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0