Menu

[Solved]6 10 Points Double Hashing Uses Hash Function Form Hash Key M Key H2 Key Mod M Ith Probe Z Q37164677

6. (10 Points) Double hashing uses a hash function of the form hash(key, i)-(M (key) + i*h2(key)) mod m, where i is the ith p

6. (10 Points) Double hashing uses a hash function of the form hash(key, i)-(M (key) + i*h2(key)) mod m, where i is the ith probe and is zero based, m is the table size, h1 and h2 are auxiliary hash functions. The initial probe goes to position h1(key)%m, and successive probe positions are offset from the previous positions by amount of h2(key)%m. For example, given h1 (key)-key 90m, h2 (key)-1 + (key%(m-2)), to insert 14 İnto the following table, the first probe is at 1, which is taken, then the second probe is at 5, which is taken as well, and the last probe is at 9 which is open, thus 14 should be inserted at index 9. 10 11 12 50 69 98 79 72 Implement the following method inside DoubleHashingST.iava. Return (h1(key) + i*h2(key)) mod m private int hash(Key key, int i) throw new UnsupportedOperationException; Return the value associated with the key public Value get(Key key) throw new UnsupportedOperationException; * Insert key value pairs into the symbol table without resizing public void put(Key key, Value val) throw new UnsupportedOperationException; Show transcribed image text 6. (10 Points) Double hashing uses a hash function of the form hash(key, i)-(M (key) + i*h2(key)) mod m, where i is the ith probe and is zero based, m is the table size, h1 and h2 are auxiliary hash functions. The initial probe goes to position h1(key)%m, and successive probe positions are offset from the previous positions by amount of h2(key)%m. For example, given h1 (key)-key 90m, h2 (key)-1 + (key%(m-2)), to insert 14 İnto the following table, the first probe is at 1, which is taken, then the second probe is at 5, which is taken as well, and the last probe is at 9 which is open, thus 14 should be inserted at index 9. 10 11 12 50 69 98 79 72 Implement the following method inside DoubleHashingST.iava. Return (h1(key) + i*h2(key)) mod m private int hash(Key key, int i) throw new UnsupportedOperationException; Return the value associated with the key public Value get(Key key) throw new UnsupportedOperationException; * Insert key value pairs into the symbol table without resizing public void put(Key key, Value val) throw new UnsupportedOperationException;

Expert Answer


Answer to 6. (10 Points) Double hashing uses a hash function of the form hash(key, i)-(M (key) + i*h2(key)) mod m, where i is the … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *