Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a hash table using chained hashing. The hash table size is determined at initialization time and never changes. Each hash table entry is a

Implement a hash table using chained hashing. The hash table size is determined at initialization time and never changes. Each hash table entry is a linked list, so each hash table entry can hold any number of values. You may use a linked list from the Java API.

Your hash table must be designed to map keys to values. None of the keys or values are allowed to be null. Keys are compared using the .equals method.

Your hash table should use the hashCode() method to compute the hash for a given string. Use Math.abs to turn that into a positive value, and modulo to make it into an array index.

Your hash table class (called Hash211) must provide the following methods:

 Hash211(int capacity, boolean printTimes); // constructor V put(K key, V value); // add or replace a Key,Value V get(Object key); // return a value for the given key 

The second parameter to the constructor specifies whether your code should print out the time (in nanoseconds) for each call to put and get.

Analysis and Measurement

You should analyze and measure the runtime of your hash table put and get operations in two cases:

When the hash table size s is much larger (at least 10 times larger) than the number n of elements added.

When the hash table size s is much less (at least 10 times less) than the number n of elements added.

Your analysis should match your measured results. Write up your analysis and make enough measurements to be clear and convincing.

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

Discuss the five types of learner outcomes.

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago