Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using java language Lab Exercise: You need to implement the followings: 1. Class HashTable that includes the instance variables: String A[; int size; Your class

image text in transcribed
image text in transcribed
using java language
Lab Exercise: You need to implement the followings: 1. Class HashTable that includes the instance variables: String A[; int size; Your class should have the following: public HashTable(int n) Create an array of strings and save the size of the hash table. public int hashFun(String s) Find the summation of characters ASCII values then apply the following function key sum % Size Use myString.charAt(int index) to get the character at location index in the string s then cast it to an in integer using (int) to get the ASCII value. public boolean insert(String s) Insert the name s in the proper location. Use linear propping when a collision happens. If the hash table is full return true. Hint: Use the function hashFun public boolean find(String s) Search the Hash Table for s and return true if it was found. Hint: Use the function hashFun public void print() Print the contents of the Hash Table. Print (****) if the slot was empty. . Write the expected time and space complexity as a comment at the beginning of each method of your class. 61 . 2. Write a test application named Lab9Test. In the main method, do the following: Create an object of class HashTable. Display a menu to the user and asking for a choice to be entered. As follows: The program can perform the following: 1- Insert a name 2- Search for a name 3- Print hash table 4 - Exit Please enter your selection: The program will perform the action selected by the user and display a proper message when necessary. The program will repeat these actions until the user terminates the program (Hint: Use a loop)

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Q.1. what is constitution? Q.2. key of the constitution?

Answered: 1 week ago

Question

Q.1. what is meant by federal system?

Answered: 1 week ago