Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Download the file lab10_base.zip, and extract as a starting point. The code includes a driver class (HashtableDriver), and a class for the hash table itself
Download the file lab10_base.zip, and extract as a starting point. The code includes a driver class (HashtableDriver), and a class for the hash table itself (Hashtable). There is an empty function in the Hashtable class, called insert), that needs to be implemented. Furthermore, there are two subclasses LinearHashtable and QuadraticHashtable, which need to be implemented to provide the definition of the rehash) method The rehash () method is used when determining the hash table index. When the initial index, returned by the provided hash) method, represents a space in the array list that is already occupied, a probing strategy is used. The rehash() method takes the previously found index (which represents an occupied space in the array list), and uses it to determine the next index. rehash() will implement these strategies: 1. LinearHashtable - the rehash() method will simply add one to the previous index, returning the new value modulus the size of the array list (capacity) o This is called linear probing en.wikipedia.or dia.org/wiki/Linear probin 2. QuadraticHashtable - the rehash() method will square the previous index, returning the new value modulus the size of the array list (capacity) o This is a variation of a probing strategy called quadratic probing ia ua ati in The insert() method will continuously call rehash() until an unoccupied position has been found, then it will insert to the new value at that position. While performing the probing, use the instance variable probeCount to keep track of how many probes is required for both hash tables import java.util.*; public abstract class Hashtable T> protected int capacity 0; private Liststring keys null; private List
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started