Assume that you have a ten-slot closed hash table (the slots are numbered 0 through 9). Show the final hash table that would result if you used the hash function h(k) = k mod 10 and pseudo-random probing. The list of numbers to be inserted in order are:
6, 15, 24, 19, 25, 44
The permutation of offsets to be used by the pseudo-random probing will be:
2, 5, 1, 8, 4, 9, 3, 6, 7
Assume that you have a ten-slot closed hash table (the slots are numbered 0 through 9)....
3. Assume that you have a seven-slot hash table (the slots are numbered 0 through 6). Show the final hash table that would result if you used the following approach to put 7, 13, 10,6 into the hash (4 points each) the hash function h(k)-k mod 7 and linear probing function the hash function h(k)-k mod 7 and quadratic probing (a) (b)
Exercise 3 (5 points). Suppose we have a hash table of m = 9 slots, and we resolve collisions by chaining. Demonstrate what happens when we insert the keys 5, 28, 19, 15, 20, 33, 12, 17, 10. Use the division-method hash function h (k) = k mod 9.
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...
1.) The value 80 will place into which slot 0-9 in a hash table using the hash function h(k) = k mod 10 Your Answer: 2.)Given the following 2 functions - what is the value of calling fb(5,2)? function fa(x, y){ if (y == 0) return 0; return (x + fa(x, y-1)); } function fb(x, y) { if (y == 0) return 1; return fa(x, fb(x, y-1)); }
1. Suppose that a hash table contains hash_size = 13 entries indexed from 0 through 12 and that the following keys are to be mapped into the table: 24 34 33 55 46 38 37 The hash function determines the hash address by first summing all digits of a key (in ordinary decimal representation) and then applying % hash_size. Answer the following questions. Assume that double hashing g(k) = 7 – (k mod 7) is used. Present the hash table...
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...
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:...
Please Answer as soon as possible. Thank you so
much.
5. Below is an array with 15 positions, which is used as a hash table to keep some IDs. The key to each record is the 3-digit customer's ID. The hash function h gives the index of the slot in the array for the key k: h(k)=%15. The method of collision resolution is double hashing. Hence, if collision happens, we repeatedly compute (h(key) + iha(key)) mod 15, for i from...
SU 2020 Example Using Chaining 0 1 A hash table which is initially empty. Every element is a LinkedList object. Only the start pointer of the LinkedList object is shown, which is set to NULL 2 3 4 5 The hash function is: 6 h(k)=k%7 CS 2121 Deliverables • Insert Following Numbers in order of 31, 9, 36, 42, 46, 20, 2, 24 After Insertion, how how you find Number 9 and 2 Scan your completed work as FirstLastHw07.pdf to...
C programming Problem 3 [Set via Hashing] As mentioned in the lecture, a hash table can be used to implement a Set ADT. Let's try to use the template below to implement a Set with double hashing. Here we assume the Set contains names with 3 characters long. Since it is a Set, we do not need to have an explicit value for each key. We will use a token value of 1 if a name belongs to the Set....