Question: Java code Run the following program and explain what it does. Modify this program so that it uses chaining, Make the array to be an

Java code  Java code Run the following program and explain what it does.

Run the following program and explain what it does. Modify this program so that it uses chaining, Make the array to be an array of pointers. Each item has a name, phone number and a field called next. You can use the name as the key and you can use the same hash function. Main java file: public class Main {public static void main(String[] args) {//TODO Auto-generated method stub Chaining h = new Chaining(); h.add("Dave", "9999"); h.add("Paula", "8888") System.out.println("Paula phone number is "+ h.get ("Paulu"));}} Chaining java file: public class Chaining {private String [] test; public Chaining() {test = new String[10];} public int HashFunc(String s) {return (s.length());} public void add (String name, String phone) {test[HashFunc(name)] = phone;} public String get(String name) {return test[HashFunc(name)];}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!