Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find out the hash value for each key. Assume the hash function as: h(k) k mod m. Assume size of the hash table as 11.

image text in transcribed

image text in transcribed

Find out the hash value for each key. Assume the hash function as: h(k) k mod m. Assume size of the hash table as 11. Then illustrate how would you construct the hash table, avoid any collision by using the double hashing. The second hash function is as given below: hz(k) 10-(k mod 10) 3. Write a C++ Program that would take a set of integers as keys and then create a hash table of size m, where m is user input. Your program must have different options for collision resolving The following functions you need to use: Value Return Function h(k) which will take an integer data k as input and would return the hash value using h(k)- h mod k Rehash function that takes two inputs: i and k (both integers) and returns the rehash value using the function: rehash(k, i) (h(k)+i g) mod m However, to obtain g you have to call g function that would return I, cl + c21 or 10-(k mod 10) depending on option-I(linear probing).-2 (quadratic probing), 3 (double hashing). Main would declare an array hashtable dynamically to store m number of data where m is hashtable size which is an user input. . . Declare using a pointer, as below int * hashtable; nt m cout

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

What is talent management?

Answered: 1 week ago