Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

i need 5 8 7 .

Answered: 1 week ago