(g - 6 pts) Construct a hash table of the given array using a hash function H(K) = K mod 5. (h - 6 pts) For the hash table of (g), determine the average number of comparisons for a successful search and the worst case number of comparisons for an unsuccessful search. (i - 9 pts) Consider the elements of the array assigned to you are known only one at a time. Construct a sequence of priority queues (as max heaps) with the insertion (enqueue) of one element at a time, as shown in the slides. (j - 7 pts) Transform the binary search tree of (c) to a min heap.
[12, 21, 12, 26, 11, 13, 26, 30, 12, 2, 3, 13]
binary search to min heap
12
21 12
26 11 13 26 replace 21 with 12
30 12 2 3 13
21
12 12
26 11 13 26 replace 12 with 26
30 12 2 3 13
21
26 12
12 11 13 26 replace 26 with 21
30 12 2 3 13
26
21 12
12 11 13 26 replace 12 with 26
30 12 2 3 13
26
21 12
30 11 13 26
12 12 2 3 13
26
30 12
21 11 13 26
12 12 2 3 13
30
26 12
21 11 13 26
12 12 2 3 13
30
26 26
21 11 13 12
12 12 2 3 13
(g - 6 pts) Construct a hash table of the given array using a hash function H(K) = K mod 5. (h - ...
JH: Student Name: 4) Given the following array, do the following (show all the work). A (56, 89, 23, 58, 22, 11, 45, 48, 90) (a - 5 pts) Construct a hash table for the given array using the hash function H(K)- K mod 5 (b- 4 pts) Determine the average number of comparisons for a successful search using the hash table of (c -3 pts) What is the worst case number of comparisons for an unsuccessful search in the...
Assume a Hash table has 7 slots and the hash function h(k) = k mod 7 is used. The keys 14, 3, 11, 6, 10, 4, 20, and 17 are inserted in the table with collision resolution by chaining. Assume that the keys arrive in the order shown. (a) Show the hash table obtained after inserting all 8 keys. [Show only the final table] (b) Under the assumption that each key is searched with probability 1/8, calculate expected number of...
10. Submission In this question you will work with a hash table that uses double hashing. The hash table is size 11, the primary hash function is h(K)-K mod 11, and the secondary hash function is hp(K)-(K mod9) +1 Take an empty hash table. Take your student number and split it into 4 2-digit integers. Insert each of these 2-digit numbers in the order in which they appear in your student number into the empty heap. Then insert the values...
For the input 26, 56, 45, 17, 58, 80, 15. 16, 13, 39 and hash function h(k) = k mod 13 1) Construct the close hash table 2) Find the largest number of key comparisons in successful search in this table 3) Find the average number of key comparisons in successful search in this table
3. Given input (89, 18, 49, 58, 69), h)k(mod 10) g) Iymod 8), and a hash function f(k) h(k) +j-g(k) (mod 10), show the resulting hash table. Solve collisions with double hashing. 3. Given input (89, 18, 49, 58, 69), h)k(mod 10) g) Iymod 8), and a hash function f(k) h(k) +j-g(k) (mod 10), show the resulting hash table. Solve collisions with double hashing.
[12, 21, 12, 26, 11, 13, 26, 30, 12, 2, 3, 13] (d - 7 pts) For the binary search tree obtained in (c), determine the average number of comparisons for a successful search and the average number of comparisons for an unsuccessful search. (e - 7 pts) Use the sorted array of (b) to construct a binary search tree. (f - 7 pts) For the binary search tree obtained in (e), determine the average number of comparisons for a...
Part 5. Suppose that your hash function resolves collisions using the open addressing method with double hashing. The double hashing method uses two hash functions h and h'. Assume that the table size N = 13, h(k) = k mod 13, h'(k) = 1 + (k mod 11), and the current content of the hash table is: 0 1 2 3 6 7 8 9 10 11 12 4 17 5 98 If you insert k = 14 to this...
5. Draw the hash table that results using the hash function: h(k)=kmod13 to hash the keys 18, 41, 22, 44, 59, 32, 31, 73. Assuming collisions are handled by Double hashing. ['M' is '7' which is less than the HTS and the hash function does not evaluate to '0'].
5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and the hash function h(x) = x mod 5. i. (1) Pick 8 random numbers in the range of 10 to 99 and write the numbers in the picked sequence. Marks will only be given for proper random numbers (e.g., 11, 12, 13, 14 ... or 10, 20, 30, 40, .. are not acceptable random sequences). ii. (2) Draw a sketch of the hash table...
Insert elements into a hash table implemented using chain hashing, as an array of linked list in which each entry slot is as a linked list of key/value pairings that have the same hash (outcome value computed using certain hash function). You are allowed to use “Hash Function”, h(k) = k % x where, x is the value you will need to decide to use, that you find appropriate for this implementation. The main requirements are the following: 1. Input:...