Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package edu.ser222.m03_04; /** * A symbol table implemented using a hashtable with linear probing. * * @author (put your name here), Sedgewick and Wayne, Acuna

image text in transcribedimage text in transcribed

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 implements ProbingHT {

//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 keys() {

//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 resizing

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

In what ways do personal and social media change how we think?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago