Question: this is about hashtable open addressing and i have no idea why my method only pass on 'removequad'. Could you please make this method works

this is about hashtable open addressing and i have no idea why my method only pass on 'removequad'.

Could you please make this method works on linear and doublehash?

public boolean remove(K key) { int initialHash = hash(key); int offset = 0; int index = getNextIndex(key, offset); Entry currentEntry = table[index]; while(currentEntry != null && currentEntry.getActive()) { if(currentEntry.getKey().equals(key)) { currentEntry.setActive(false); size--; return true; } offset++; if(offset >= capacity) { throw new RuntimeException("Infinite Loop"); } index = getNextIndex(key, offset); currentEntry = table[index]; } return false; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!