Is there anyone who knows how to do this? This is a project that I need to work
ID: 3551186 • Letter: I
Question
Is there anyone who knows how to do this? This is a project that I need to work on for my Algorithm course and I am in desperate need for help! This project needs to be completed by using NetBeans IDE. Here's how the project works:
The goal of this project is to explore the insertion performance of a hash table, using linear probing. The objective is to produce a data set that shows the average displacement for the entire data set of size N when it is placed in a hash table of size M for various value of the ratio N/M.
Code (Algorithm) for Hashing with Linear Probing:
public class LinearProbingHashST<key, Value>
{
private int N; // number of key-value pairs in the table
private int M = 16; // size of linear-probing table
private Key[] keys; // the keys
private Value[] vals; // the values
public LinearProbingHashST()
{
keys = (Key[]) new Object[M];
vals = (Value[]) new Object[M];
}
private int hash(Key key)
{ return (key.hashCode() & 0x7fffffff) % M; }
private void resize() // See code below
public void put(Key key, Value val)
{
if (N >= M/2) resize(2*M); // double M
int I;
for (i = hash(key); keys[i] != null; i = (i + 1) % M)
if (keys[i].equals(key)) { vals[i] = val; return; }
keys[i] = key;
vals[i] = val;
N++;
}
public Value get(Key key)
{
for (int i = hash(key); keys[i] != null; i = (i + 1) % M)
if (keys[i].equals(key))
return vals[i];
return null;
}
}
Code for resizing a linear-probing hash table:
Private void resize(int cap)
{
LinearProbingHashST<Key, Value> t;
t = new LinearProbingHashST<Key, Value(cap);
for (int i = 0; i < M; i++)
if (keys[i] != null)
t.put(keys[i], vals[i]);
keys = t.keys;
vals = t.vals;
M = t.M;
}
The steps for this project are as follows:
The report for this project must consist of:
Explanation / Answer
I have the solution.Just tell me your gmail or some othe so i can send the file since i am not able to do because of size and image constraints
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.