Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following numbers in a Python list: [28, 24, 23, 9, 1] In the hash table below of size 7 ([None, None, None, None,

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Consider the following numbers in a Python list: [28, 24, 23, 9, 1] In the hash table below of size 7 ([None, None, None, None, None, None, None]) with the hash function h(key) = key % 7 and with an initially empty table assuming that the linear probing technique is used to resolve the collisions and the numbers are to be inserted into the hashtable one by one. What is the probe sequence when inserting each element from the list into the hashtable? Write the expected result as a list of indices. Note: The first 2 steps have been done for you. Complete the remaining cases. Answer: (penalty regime: 0, 0, 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer Test Expected Result print (get_probes ( [28, 24, 23, 9, 1], 1)) #insert the first element [0] print(get_probes ( [28, 24, 23, 9, 1), 2)) #insert the second element [3] print(get_probes ( [28, 24, 23, 9, 1], 3)) print (get_probes ( [28, 24, 23, 9, 1], 4)) print(get_probes ( [28, 24, 23, 9, 1], 5)) Add row Delete row Consider the following numbers in a Python list: [28, 14, 7, 38, 31] In the hash table below of size 7 with the hash function h(key) = key % 7 and with an initially empty table assuming that the quadratic probing technique is used to resolve the collisions, what does the hash table look like if the numbers are to be inserted into the hashtable one by one? Note: The first step has been done for you. Complete the remaining cases. Answer: (penalty regime: 0 %) Reset answer Test Expected Result print (put_up_to( [28, 14, 7, 38, 31], 1)) #insert the first element [28, None, None, None, None, None, None] print (put_up_to( [28, 14, 7, 38, 31), 2)) #insert the second element print (put_up_to( [28, 14, 7, 38, 31), 3)) print (put_up_to( [28, 14, 7, 38, 31], 4)) print (put_up_to ( [28, 14, 7, 38, 31], 5)) Add row Delete row Consider the following numbers in a Python list: [26, 33, 5, 12, 39] In the hash table below of size 7 ([None, None, None, None, None, None, None]) with the hash function h(key) = key % 7 and with an initially empty table assuming that the quadratic probing technique is used to resolve the collisions and the numbers are to be inserted into the hashtable one by one. What is the probe sequence when inserting each element from the list into the hashtable? Write the expected result as a list of indices. Note: The first 2 steps have been done for you. Complete the remaining cases. Answer: (penalty regime: 0 %) Reset answer Test Expected Result print (get_probes ( [26, 33, 5, 12, 39], 1)) #insert the first element [5] print(get_probes ( [26, 33, 5, 12, 39), 2)) #insert the second element [5, 6] print (get_probes ( [26, 33, 5, 12, 39), 3)) print (get_probes ( [26, 33, 5, 12, 39], 4)) print (get_probes ( [26, 33, 5, 12, 39], 5)) Add row Delete row Consider the following numbers in a Python list: In the hash table below of size 7 with the hash function h(key) = key % 7 and with an initially empty table assuming that the double hashing with the second hash function h2 (key) = 5 (key % 5) probing technique is used to resolve the collisions, what does the hash table look like if the numbers are to be inserted into the hashtable one by one? Note: The first step has been done for you. Complete the remaining cases. Answer: (penalty regime: 0 %) Reset answer Test Expected Result print(put_up_to( [26, 33, 5, 12, 39], 1)) #insert the first element [None, None, None, None, None, 26, None] print (put_up_to( [26, 33, 5, 12, 39), 2)) #insert the second element print (put_up_to( [26, 33, 5, 12, 39], 3)) print (put_up_to( [26, 33, 5, 12, 39), 4)) print (put_up_to( [26, 33, 5, 12, 39), 5)) Add row Delete rowy Consider the following numbers in a Python list: [21, 14, 42, 11, 47] In the hash table below of size 7 ([None, None, None, None, None, None, None]) with the hash function h(key) = key % 7 and with an initially empty table assuming that the double hashing probing technique is used to resolve the collisions and the numbers are to be inserted into the hashtable one by one. The second hash function is h2(key) = 5 - (key % 5). What is the probe sequence when inserting each element from the list into the hashtable? Write the expected result as a list of indices. Note: The first 2 steps have been done for you. Complete the remaining cases. Answer: (penalty regime: 0 %) Reset answer Test Expected Result print (get_probes ( [21, 14, 42, 11, 47], 1)) #insert the first element [0] print (get_probes ( [21, 14, 42, 11, 47], 2)) #insert the second element print (get_probes ( [21, 14, 42, 11, 47], 3)) print (get_probes ( [21, 14, 42, 11, 47], 4)) print(get_probes ( [21, 14, 42, 11, 47], 5)) Add row Delete row

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 Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

1. Design an effective socialization program for employees.

Answered: 1 week ago