Menu

[Solved]Double Hashing Uses Hash Function Form Hash Key H1 Key H2 Key Mod M Ith Probe Zero Based M Q37191230

Double hashing uses a hash function of the form

hash(key, i) = (h1(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 toposition h1(key)%m, and successive probe positions are offset fromthe previous positions by amount of h2(key)%m. For example, givenh1(key) = key %m, h2(key) = 1 + (key%(m-2)), to insert 14 into thefollowing table, the first probe is at 1, which is taken, then thesecond probe is at 5, which is taken as well, and the last probe isat 9 which is open, thus 14 should be inserted at index 9.

Implement the following method inside DoubleHashingST.java:

Return (h1(key) + i*h2(key)) mod m

*/

private int hash(Key key,int i) {

       thrownew UnsupportedOperationException();

}

/*

* Return the value associated with the key

*/

public Value get(Key key) {

       thrownew UnsupportedOperationException();

/*

* Insert key value pairs into the symbol table withoutresizing

*/

public void put(Key key, Valueval) {

       thrownew UnsupportedOperationException();

}

/*

* Delete key value pairs from the symbol table withoutresizing

*/

public void delete(Key key){

       thrownew UnsupportedOperationException();

0

1

2

3

4

5

6

7

8

9

10

11

12

79

69

98

72

50

Expert Answer


Answer to Double hashing uses a hash function of the form hash(key, i) = (h1(key) + i*h2(key)) mod m, where i is the ith probe and… . . .

OR


Leave a Reply

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