Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These questions come from Object-Oriented Data Structures Using Java Third Edition, chapter 10. For Exercises 42-45, use the following values: 66, 47, 87, 90, 126,

These questions come from Object-Oriented Data Structures Using Java Third Edition, chapter 10.

For Exercises 42-45, use the following values: 66, 47, 87, 90, 126, 140, 145, 153, 177, 285, 393, 395, 467, 566, 620, 735

42. Store the values into a hash table with 20 positions, using the division method of hashing and the linear probing method of resolving collisions.

43. Store the values into a hash table with 20 positions, using rehashing as the method of collision resolution. Use key % tableSize as the hash function, and (key + 3) % tableSize as the rehash function.

44. Store the values into a hash table with 10 buckets, each containing three slots. If a bucket is full, use the next (sequential) bucket that contains a free slot.

45. Store the values into a hash table that uses the hash function key % 10 to determine which of 10 chains to put the value into.

46. Fill in the following table, showing the number of comparisons needed to find each value using the hashing representations given in Exercises 42-45.

Value Exercise 42 Exercise 43 Exercise 44 Exercise 45
66
467
566
735
285
87

47.True or False? Explain your answers.

a. When a hash function is used to determine the placement of elements array, the order in which the elements are added does not affect the array.

b. When hashing is used, increasing the size of the array always reduces the number of collisions.

c. If we use buckets in a hashing scheme, we do not have to worry about collision resolution.

d. If we use chaining in a hashing scheme, we do not have to worry about collision resolution.

e. The goal of a successful hashing scheme is an 0(1) search.

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_2

Step: 3

blur-text-image_3

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 Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions