Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

objective: Work with hash tables by creating a hash table using linear probing Description: Create a generic class called LinearProbingHashTablecK,> It should contain a private

image text in transcribed

objective: Work with hash tables by creating a hash table using linear probing Description: Create a generic class called LinearProbingHashTablecK,> It should contain a private static class, Entry Because Java cannot create an array of a generic class, create the array for the table 1ike this: EntrycK, v> table / declare generic table new Entrytsize]: / create as non-generic Note that this will generate a warning message when compiled Your class should have the following methods. The methods should all operate on the object making the cal1 (none are static) Perform checking of the parameters and throw exceptions where appropriate You may use code from the textbook, but all other code must be your own. 15 points a) public boolean insert(K key, V value) inserts entry, rehashes if half full, can re-use deleted entries, throws exception if key is null, returns true if inserted, false if duplicate 15 points b) public v find(K key) returns value for key, or null if not found 15 points c) public boolean delete(K key) marks the entry deleted but leaves it there, returns true if deleted, false if not found 15 points d) private void rehash( doubles the table size, hashes everything to the new table, omitting items marked deleted 10 points e) public int getHashvalue(K key) returns the hash value for the given key (this is the value before probing occurs) 10 points f) public int getlocation( key) returns the location for the given key or -1 if not found (this is the value after probing occurs) 10 points g} public String toString returns a formatted string of the hash table, where k, v is the key and value at this location: 0 k,v 2 k, v deleted 10 points h) public static void main(String args ]) demonstrate each of your methods

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

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions

Question

1. What is corporate culture? Why is it important? (Appendix)

Answered: 1 week ago