Question: 7 . 1 2 LAB Hashing Linear Probing Modify Main.java to implement the following linear probing exercise. The keys 1 2 , 1 8 ,
LAB Hashing Linear Probing
Modify Main.java to implement the following linear probing exercise.
The keys and are inserted into an initially empty hash table of length using open addressing with hash function hk k mod and linear probing.
Modify the main method to replace random numbers with the above eight numbers in sequence.
Input commands Strings are limited to "show", "insert", "delete", and "find".
Do not display the menu nor any prompt to enter a number.
Input
show exit
Output
Table:
Input
insert delete insert show find exit
Output
Table: Could not find
Starter Code:
import java.util.Scanner;
Note: The Scanner nextInt method does not read the newline character in your input created
by hitting "Enter," and so the call to Scanner nextLine to read or flush that newline.
public class Main
public static void mainString args
Scanner scnr new ScannerSystemin;
DataItem aDataItem;
int aKey, size, n keysPerCell;
get sizes
System.out.printEnter size of hash table: ;
size scnrnextInt;
System.out.printEnter initial number of items: ;
n scnrnextInt;
keysPerCell ;
make table
HashTable theHashTable new HashTablesize;
forint j; j
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
