Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help. Also, Please only do exactly what is required and no additional commands or code. Thank you!! The goal of this project is to

Please Help. Also, Please only do exactly what is required and no additional commands or code. Thank you!!

The goal of this project is to explore the insertion performance of a hash table, using linear probing. You will 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.

1. First, implement the hash table class described in the text book.

2. Next, write a test method (you can use the main() method of your HashTable class) that adds values to the hash table. You can generate random integers, or read words from a file, or anything convenient for you (I generated random numbers using StdRandom.uniform(1000000)). Each time a value is added, you will need to measure and record the displacement (how far each entry had to be shifted from its natural position, due to collision).

3. Generate a data set consisting of the average displacement across the whole data set (all N keys). Actually, you will need to do this a number of times.

4. Run step 3 for a variety of values of N for a given M.

5. Produce a graph: the X values are the different ratios of N/M, and the Y values are the average displacement across a number of data sets. The completeness and accuracy of your graph will be a significant part of your grade (3 or 4 data points won't cut it).

6. Finally, discuss your findings.

Your report will consist of:

1. Your Java source code for the final program;

2. a brief statement of your approach to the problem;

3. the table and graph of results; and

4. a paragraph in which you describe the results.

computer code:

if this doesnt help please write own hash

image text in transcribed

public class Transaction private final String who; private final Date when; private final double amount public int hashCode O int hash = 17; hash 31 hash +who.hashCode O; hash 31 hash when.hashCode) hash- 31 hash ((Double) amount).hashCode(); return hash; public class Transaction private final String who; private final Date when; private final double amount public int hashCode O int hash = 17; hash 31 hash +who.hashCode O; hash 31 hash when.hashCode) hash- 31 hash ((Double) amount).hashCode(); return hash

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions