Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: The purpose of this lab is to better understand the components of a hash table, including the array to hold the data, the hash

image text in transcribed
image text in transcribed
image text in transcribed
Purpose: The purpose of this lab is to better understand the components of a hash table, including the array to hold the data, the hash function to map the key to the array index, collision resolution, and rehashing. What to do: Use an array for the hash table, starting with a size of 5. Each time the array gets to 80% capacity, double its size. Create a class to hold the data, which will be key-value pairs. The class should contain a field for the key and a field for the value. . . o The key will be an integer and the value will be a string Use a simple hash function . o key % hashTable. length For collision resolution, use open addressing with linear probing . The program should include: . . . A class to hold the key-value pairs A class to hold the array of key-value pairs A method to insert data into the hash table Since the hash function and collision resolution are simple, you could include them in this method, or you could write separate methods for them. A method to double the size of the array when needed, and arehash method to go along with it. You may test your program with a separate class for the driver, or just put a main method in the same class as the array of key-value pairs Implement a way to print out the contents of the hash table for testing. Implementing search and delete methods are not required for this lab

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Are these written ground rules?

Answered: 1 week ago

Question

How do members envision the ideal team?

Answered: 1 week ago

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago