Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me to complete these Question 7 (Total 10 marks): Hash Tables a) (4 marks). Given the following hash function that maps an integer

image text in transcribed

please help me to complete these

Question 7 (Total 10 marks): Hash Tables a) (4 marks). Given the following hash function that maps an integer key to an index given a table of length 10: public int hash(int key) { int hashIdx; hashIdx = key % 10; return hasIdx; } def hash(key): hashIdx = key % 10 return hashIdx Use the above hash function to insert the following key-value pairs into the hash table below. Handle collisions using the Quadratic Probing method. Key: Value 37: "Frankie" Index Key Value 0 27: "Boris" 1 2 93: "Lisa" 3 257: "Imran" 4 5 12346: "Alice" 6 7 8 9 O 0 b) (3 marks). Would separate chaining make a more efficient hashtable in the above example? Why/Why not? c) (3 marks). Give an example of a program that might use a hashtable and explain why it would be a useful data structure for that task

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

Students also viewed these Databases questions

Question

What are three reasons projects are initiated?

Answered: 1 week ago