Question: PYTHON SECTION 1. Linear probing Enter your answer below according to how each key will be added using linear probing : Fill in your answer
PYTHON





SECTION 1. Linear probing Enter your answer below according to how each key will be added using linear probing : Fill in your answer below Remember that it is critical that you provide your answer as a list of Lists nawed 'student_answer". See the above example. Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the wentioned Left-to-right order. student answer = 0 YOUR CODE HERE raise Not ImplementedError() : TEST 11.1 No explicit tests available for the student to run! Please check your work carefully! TEST 11.2 No explicit tests available for the student to run! Please check your work carefully! : TEST 11.3 No explicit tests available for the student to run! Please check your work carefully! TEST 11.4 No explicit tests available for the student to run! Please check your work carefully! TEST 11.5 No explicit tests available for the student to run! Please check your work carefully! Fourth, you will be adding each of the keys in keys into the hash table one by one, from left to right, as we always did in lectures. For each of the following probing/hashing approaches, you will specify a single list of lists named student_answer, in which each sublist will specify the state of the M-long array after adding each key value: Linear probing new_hash_value = (original_hash_value + i) % M Modified linear probing: new_hash_value = (original_hash_value + i* c) % M . Quadratic probing: . new_hash_value = (original_hash_value i**2) XM Double hashing: hp = lambda key: 1 + key %P new_hash_value (original_hash_value + i * hp( key )) % M The formula for computing the slot index for each approach has been given above. The original hash value, original_hash_value , is computed by the formula key %M For example, say, there are 3 keys, [3, 8, 1] , to be entered with a hash table of size 5 (M=5 ) using linear probing. You an use - (or None ) to specify available slots in the hash table, because doing will be easier visually for you as you create your answer. So, as answer, you may specify: L- student_answer = [ 3, -1, # After adding 3 [ - 3, 8], # After adding 8 L_, 1, # After adding 1 ] - 3, 8] Note that each - placeholder will evaluate to None (see earlier definition). HINT You may wish to write short programs to figure out the answer for each case SECTION 2. Modified linear probing Enter your answer below according to how each key will be added using modified linear probing FILL in your answer below 4 Remember that it is critical that you provide your answer as a list of Lists named 'student_answer" Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the mentioned Left-to-right order. student answer - YOUR CODE HERE raise Not ImplementedError() . TEST 12.1 No explicit tests available for the student to run! Please check your work carefully! TEST 12.2 No explicit tests available for the student to run! Please check your work carefully! 4 TEST 12.3 No explicit tests available for the student to run! Please check your work carefully! TEST 12.4 # No explicit tests available for the student to run! Please check your work carefully! TEST 12.5 4 # No explicit tests available for the student to run! Please check your work carefully! SECTION 3. Quadratic probing Enter your answer below according to how each key will be added using quadratic probing 0 0 Fill in your answer below 0 . Remember that it is critical that you provide your answer as a list of Lists . named 'student_answer Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 . sublists, each of which representing the state of the hash table after the . addition of each key in the mentioned Left-to-right order. student answer = 0 YOUR CODE HERE raise Not ImplementedError() 0 . . TEST 13.1 No explicit tests available for the student to run! Please check your work carefully! TEST 13.2 . . . No explicit tests available for the student to run! Please check your work carefully! TEST 13.3 .. . 0 . .. No explicit tests available for the student to run! Please check your work carefully! . . . TEST 13.4 No explicit tests available for the student to run! Please check your work carefully! .. .. TEST 13.5 .. No explicit tests available for the student to run! . Please check your work carefully! SECTION 4. Double hashing Enter your answer below according to how each key will be added using double hashing Fill in your answer below Remember that it is critical that you provide your answer as a List of Lists nawed 'student_answer * Please see the above-provided specifications for more details. 1 Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the went ioned Left-to-right order. student answer = 0 # YOUR CODE HERE raise Not ImplementedError() TEST 14.1 4 No explicit tests available for the student to run! # Please check your work carefully! TEST 14.2 No explicit tests available for the student to run! Please check your work carefully! TEST 14.3 No explicit tests available for the student to run! # Please check your work carefully! TEST 14.4 No explicit tests available for the student to run! Please check your work carefully! TEST 14.5 # No explicit tests available for the student to run! Please check your work carefully! SECTION 1. Linear probing Enter your answer below according to how each key will be added using linear probing : Fill in your answer below Remember that it is critical that you provide your answer as a list of Lists nawed 'student_answer". See the above example. Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the wentioned Left-to-right order. student answer = 0 YOUR CODE HERE raise Not ImplementedError() : TEST 11.1 No explicit tests available for the student to run! Please check your work carefully! TEST 11.2 No explicit tests available for the student to run! Please check your work carefully! : TEST 11.3 No explicit tests available for the student to run! Please check your work carefully! TEST 11.4 No explicit tests available for the student to run! Please check your work carefully! TEST 11.5 No explicit tests available for the student to run! Please check your work carefully! Fourth, you will be adding each of the keys in keys into the hash table one by one, from left to right, as we always did in lectures. For each of the following probing/hashing approaches, you will specify a single list of lists named student_answer, in which each sublist will specify the state of the M-long array after adding each key value: Linear probing new_hash_value = (original_hash_value + i) % M Modified linear probing: new_hash_value = (original_hash_value + i* c) % M . Quadratic probing: . new_hash_value = (original_hash_value i**2) XM Double hashing: hp = lambda key: 1 + key %P new_hash_value (original_hash_value + i * hp( key )) % M The formula for computing the slot index for each approach has been given above. The original hash value, original_hash_value , is computed by the formula key %M For example, say, there are 3 keys, [3, 8, 1] , to be entered with a hash table of size 5 (M=5 ) using linear probing. You an use - (or None ) to specify available slots in the hash table, because doing will be easier visually for you as you create your answer. So, as answer, you may specify: L- student_answer = [ 3, -1, # After adding 3 [ - 3, 8], # After adding 8 L_, 1, # After adding 1 ] - 3, 8] Note that each - placeholder will evaluate to None (see earlier definition). HINT You may wish to write short programs to figure out the answer for each case SECTION 2. Modified linear probing Enter your answer below according to how each key will be added using modified linear probing FILL in your answer below 4 Remember that it is critical that you provide your answer as a list of Lists named 'student_answer" Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the mentioned Left-to-right order. student answer - YOUR CODE HERE raise Not ImplementedError() . TEST 12.1 No explicit tests available for the student to run! Please check your work carefully! TEST 12.2 No explicit tests available for the student to run! Please check your work carefully! 4 TEST 12.3 No explicit tests available for the student to run! Please check your work carefully! TEST 12.4 # No explicit tests available for the student to run! Please check your work carefully! TEST 12.5 4 # No explicit tests available for the student to run! Please check your work carefully! SECTION 3. Quadratic probing Enter your answer below according to how each key will be added using quadratic probing 0 0 Fill in your answer below 0 . Remember that it is critical that you provide your answer as a list of Lists . named 'student_answer Please see the above-provided specifications for more details. Since there are 10 keys to be added to the hash table, you must provide 10 . sublists, each of which representing the state of the hash table after the . addition of each key in the mentioned Left-to-right order. student answer = 0 YOUR CODE HERE raise Not ImplementedError() 0 . . TEST 13.1 No explicit tests available for the student to run! Please check your work carefully! TEST 13.2 . . . No explicit tests available for the student to run! Please check your work carefully! TEST 13.3 .. . 0 . .. No explicit tests available for the student to run! Please check your work carefully! . . . TEST 13.4 No explicit tests available for the student to run! Please check your work carefully! .. .. TEST 13.5 .. No explicit tests available for the student to run! . Please check your work carefully! SECTION 4. Double hashing Enter your answer below according to how each key will be added using double hashing Fill in your answer below Remember that it is critical that you provide your answer as a List of Lists nawed 'student_answer * Please see the above-provided specifications for more details. 1 Since there are 10 keys to be added to the hash table, you must provide 10 sublists, each of which representing the state of the hash table after the addition of each key in the went ioned Left-to-right order. student answer = 0 # YOUR CODE HERE raise Not ImplementedError() TEST 14.1 4 No explicit tests available for the student to run! # Please check your work carefully! TEST 14.2 No explicit tests available for the student to run! Please check your work carefully! TEST 14.3 No explicit tests available for the student to run! # Please check your work carefully! TEST 14.4 No explicit tests available for the student to run! Please check your work carefully! TEST 14.5 # No explicit tests available for the student to run! Please check your work carefully
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
