IN JAVA LANGUAGE:
For this lab you are required for implement the following methods:
1. public QuadraticProbingHashTable( int size ):
As the signature of this method suggests, this is a constructor for this class. This constructor will initialize status of an object from this class based on the input parameter (i.e., size). So, this function will create the array HashTable with the specified size and initialize all of its elements to be null.
2. public int hash(int value, int tableSize ):
This method accepts an integer value and returns the hash value based on the table size. Note that you are supposed to use mod operator as we saw in class for your hash function. That means the hash value you are returning is going to be a number between 0 and tableSize-1. The input value can be positive or negative. This function is not supposed to handle the probing. Collision handling and probing should be part of your insert function (or another helper function).
3. public void insert( int x )
This function accepts a value (called x) and insert it into the hash table. If the item is already in the table, this method does nothing and returns. You need to resolve collision using quadratic probing. It is highly recommended that you write a helper function to do this (but this is not mandatory). Note that other fields of this class has to be updated accordingly after the insert. If the load factor of the table is 0.75 or higher after the insert, this function should perform rehashing as instructed below. For this assignment, check the load factor first (assuming that the value will be added to the table), if rehash is required, rehash first and then insert the value.
4. public void rehash( )
This function will increase the size of the hash table by a factor of two and rehash the elements into the new hash table (your insert method should call the rehash function as soon as the load factor of the hash table is equal or greater than 0.75.
do NOT change any signature (parameters) in any method.
no need to actually run the program. other files are required but not for this portion just yet.

PROGRAM
public class QuadraticProbingHashTable
{
public HashEntry[] HashTable;
public int currentSize;
double load;
int size;
public QuadraticProbingHashTable(int size)
{
currentSize=0;
load=0;
this.size=size;
HashTable=new HashTable[size];
for(int i=0;i<size;i++)
HashTable[i]=null;
}
public void insert(int x)
{
if(load>=0.75)
rehash();
else
{
if(!search(x))
{
int h=hash(x,size);
HashTable[h]=x;
currentSize++;
load=(double)currentSize/(double)size;
if(load>=0.75)
rehash();
}
}
}
public boolean search(int x)
{
for(int i=0;i<size;i++)
{
if(x==HashTable[i])
{
return true;
}
}
return false;
}
public int hash(int value,int tablesize)
{
int h=value%tablesize;
if(HashTable[h]==null)
return h;
else
h=quadratic(value,tablesize);
return h;
}
public void rehash()
{
HashTable[] ht=new HashTable[size];
ht=HashTable;
HashTable=new HashTable[size*2];
size=size*2;
for(int i=0;i<size/2;i++)
{
if(ht[i]!=null)
{
insert(ht[i],size);
}
}
}
public int quadratic(int x,int tablesize)
{
int h,i=1;
h=x%tablesize;
while(true)
{
if(HashTable[h+i*i]==null)
return h+i*i;
else
i++;
}
}
}
![public class QuadraticProbingHashTable public HashEntryL] HashTable public int currentSize; double load; int size; public QuadraticProbingHashTable(int size) currentSize-0 load-0; this.size-size; HashTable-new HashTable[size]; for(int i-0;i<size;i++) HashTableľi1-null: public void insert(int x) if(load>-0.75) rehash(); else if( search(x)) int h-hash(x,size); HashTable [h1-X; currentSize++; load-(double)currentSize/ (double)size; if(load>-0.75) rehash(); public boolean search(int x) for(int i-0;i<size;i++) if(x--HashTable[i]) return true;](http://img.homeworklib.com/questions/fc1f3510-ffd5-11eb-b8fe-bd8c543b7d7c.png?x-oss-process=image/resize,w_560)


IN JAVA LANGUAGE: For this lab you are required for implement the following methods: 1. public...
The task of this project is to implement in Java Hash Table structure using Linear Probing Collision Strategy. You can assume that no duplicates or allowed and perform lazy deletion (similar to BST). Specification Create a generic class called HashTableLinearProbe <K,V>, where K is the key and V is the value. It should contain a private static class, HashEntry<K,V>. Use this class to create array to represent Hashtable: HashEntry<K,V> hashtable[]; Implement all methods listed below and test each method...
Implement the remove() and the rehash() methods for the following externally chained hash table. Note you should rehash when "size > arraySize" at the start of the put() method. The new size of the arraySize should be "(2 * old array size) + 1" import java.util.ArrayList; import java.util.Hashtable; import java.util.LinkedList; import java.util.Map; public class ExternalChainingHashTable<K,V> { private class Mapping { private Mapping next; private K key; private V value; private Mapping(K key, V value) { this.key = key; this.value =...
Your task is to go through and implement the methods getBucketIndex, add, get, and remove. Follow the comments inside respective methods. import java.util.ArrayList; import java.util.Scanner; public class HashtableChaining<K, V> { // Hashtable bucket private ArrayList<HashNode<K, V>> bucket; // Current capacity of the array list private int numBuckets; // current size of the array list private int size; public HashtableChaining(int buckets){ bucket = new ArrayList<>(); numBuckets = buckets; ...
Follow the TODOs and complete the insertItem(), searchItem() and printTable() functions in hash.cpp. The hash function has already been implemented for you. // hash.CPP program to implement hashing with chaining #include<iostream> #include "hash.hpp" using namespace std; node* HashTable::createNode(int key, node* next) { node* nw = new node; nw->key = key; nw->next = next; return nw; } HashTable::HashTable(int bsize) { this->tableSize= bsize; table = new node*[tableSize]; for(int i=0;i<bsize;i++) table[i] = nullptr; } //function to calculate hash function unsigned int HashTable::hashFunction(int key)...
Hash Tables. (Hint: Diagrams might be helpful for parts a) and b). ) When inserting into hash table we insert at an index calculated by the key modulo the array size, what would happen if we instead did key mod (array_size*2), or key mod (array_size/2)? (Describe both cases). Theory answer Here Change your hashtable from the labs/assignments to be an array of linkedlists – so now insertion is done into a linkedlist at that index. Implement insertion and search. This...
PROGRAM DESCRIPTION Implement a hash table class. Your hash table should resolve collisions by chaining and use the multiplication method to generate hash keys. You may use your own linked list code from a previous assignment or you can use a standard sequence container. Partial definitions for the hash table class and a generic data class are provided (C++ and Java versions). You may use them as a starting point if you wish. If you choose to design your own...
Java Quadratic Probing Hash table HELP! Complete the Map and Entry class provided in Map.java. Create a tester/driver class to show the Map class is working as intended. Methods/Constructor correctly completed (2pt) This is the Map class methods Map(), put(key, value), get(key), isEmpty(), makeEmpty() Private class correctly completed (2pt) This is the Entry class methods Add the methods that are required for this to work correctly when stored in the QuadraticProbingHashTable Tester class (1pt) Show the methods of the Map...
Java you are required to add a public Object get( Object key) method into the Hashtable class. As defined in the Java documentation, the get() method returns the value with which the specified key is associated, or null if this hash table contains no record for the key. More formally, if this hash table contains a mapping from a key k to a value v such that (key.equals(k)), then this method returns v; otherwise it returns null. (There can be...
You are given the following data 659, 230, 751, 291, 433, 955, 518, 34, 189, 239 to insert into a table of size 10. The hash function is hash(key) = key mod tableSize. Assume that the table is allowed to get full without starting a rehashing. Draw the resulting hash table when open addressing with quadratic probing is used. You must write the indices calculated by the hash function hash(key) and by the probing strategy hi(key) for all reattempts, for...
Please answer this problem in C++, Thank you! Read and study the sample program: "hashing with chaining using singly linked lists", as well as "hashing with chaining using doubly linked lists". Notice this program is complete except it doesn't include the remove function. Write the remove function and test it with the rest of the program including the given main program. Upload your C++ source file. ---Here is the referenced program: "hashing with chaining using singly linked lists". Below this...