Question
package edu.ser222.m03_04; /** * A symbol table implemented using a hashtable with linear probing. * * @author (put your name here), Sedgewick and Wayne, Acuna
package edu.ser222.m03_04;
/**
* A symbol table implemented using a hashtable with linear probing.
*
* @author (put your name here), Sedgewick and Wayne, Acuna
*/
import java.util.LinkedList;
import java.util.Queue;
public class CompletedLinearProbingHT
//any constructors must be made public
@Override
public int hash(Key key, int i) {
//TODO
return 0;
}
@Override
public void put(Key key, Value val) {
//TODO
}
@Override
public Value get(Key key) {
//TODO
return null;
}
@Override
public void delete(Key key) {
//TODO
}
@Override
public boolean contains(Key key) {
//TODO
return false;
}
@Override
public boolean isEmpty() {
//TODO
return false;
}
@Override
public int size() {
//TODO
return 0;
}
@Override
public Iterable
//TODO
return null;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// THESE METHODS ARE ONLY FOR GRADING AND COME FROM THE PROBINGHT INTERFACE.
@Override
public int getM() {
//TODO. We suggest something like:
//return M;
return 0;
}
@Override
public Object getTableEntry(int i) {
//TODO. We suggest something like:
//return entries[i];
return 0;
}
}
PLEASE DO EVERYTHING THAT SAYS TODO
Write a class called CompletedLinearProbingHT that implements a linear probe hashtable. | 32 points total =26 points +6 extral - Proper hash calculations: * Use the basic hash function given in the slides: hash (k,i)=((khashCode()& 0x7ffffff )+i) \% M, where k is the key and i is the number of collisions. Each time there is a collision, this will increase the hash by 1 . * Do not use parallel arrays. (This will be checked manually.) - LinearProbingHT() - a constructor that defaults to an array of size 997. - void put(Key key, Value val) - see interface. - Value get(Key key) - see interface. - void delete(Key key) - see interface. Do not degrade performance by using tags or extra nulls; you must update the probe sequence containing the element being deleted. [6 points extra credit] - boolean contains(Key key) - see interface. - boolean isEmpty() - see interface. - int size () - see interface. - Iterable keys( ) - see interface. - There is no requirement to support array resizingStep 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