Initially the hashtable will be empty.
Given hash function is key % 7.
1. For key 15, 15%7 = 1. So, it will be inserted at 1.
2. Next 4 is inserted at 4 (since 4%7 = 4)
3. Next element is 22. Now 22%7 = 1. But index 1 is already occupied with 15. Now separate chaining occurs. A new list will be created at the index 1 where rest of the elements with same hash value can be placed.
4. Next element is 7. 7%7 = 0. Hence it will be placed at index 0.
5. Next element is 18. 18%7 = 4. Since 4 is already occupied with element 4. Chaining occurs.
6. 21 will be placed at 0 (with chaining) since 21%7 = 0.
7. 8 will be placed at index 1 (appended in the list) since 8%7 = 1.
8. 35 too will be placed at index 0 since 35%7 = 0.
9. Now 11 will be appended at index 4 since 11%7 = 4.
10. 28 will be appended at index 0 since 28%7 = 0. (This is the final hashtable state)
In C++ raw the hash table that results from separate chaining using the follo 15 4...
Separate Chaining A hash table of size 7 uses separate chaining to resolve collisions. A polynomial hash function where a 33 is used. Sketch the table's contents after the following words have been added in the exact order shown: find, edge, body, race, plan, beat, they You may find it useful to create a list of lowercase letters and their ASCII numeric value. The letter a's value is 97 and z's value is 122. Linear Probing: A hash table of...
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...
Assume you are given a separate chaining hashtable where M=11. Give the final hashtable after adding keys: 24, 1, 4, 11, 12, 22, 33, 45, 8, 19, and 10. Use the hash function hash(k) = k mod 11, where k is the key. Include the main size M array with lists located at each index. Only include the key, not the hashed value, in your final table. Your table should look similar to the one below. Index List 0 [Key1,...
Java question need help
For the data elements can be item1, item2, item3 ,item4....
etc.
List the contents of a hash table of SIZE 10 filled using chaining Use the hash function: index= ((string. length() * 3) The data elements are: Add the elements in the order given List the elements contained in each "bucket" (if any) Elements should be chained in the order added, separated by a comma and a space If an index is empty enter the word...
secondary clustering in a hash table occurs when using a. separate chaining b. double hashing c. linear probing d. quadratic probing
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'].
10. (5 points) Consider data with integer keys 28, 21, 11, 47, 36, 19, 32 in that order inserted into a hash table of size 7 and hashing function is h(key) = k % 7. Show a chaining hash table after doing the insertions:
for
java
4. Instead of using a linked list to resolve collisions, as in separate chaining, use a binary search tree. That is, create a hash table that is an array of trees. To display a small tree-based hash table, you could use an inorder traversal of each tree. The advantage of a tree over a linked list is that it can be searched in O(logN) instead of O(N) time. This time savings can be a significant advantage if very...
It should be really short and simple to do this.
#1 [8 points) Sketch a hash table of size N=11, where the hash function is hash(key) = key mod N and chaining is used to resolve collisions, when the following elements are inserted: 20, 42, 45, 49, 62, 72,95 0 1 2 3 4 5 6 7 8 9 10 What is the size of the largest bucket? — #2 [7 points) Sketch a hash table of size N=11, where...
vas Х Question 1 5 Secondary clustering in a hash table occurs when using Separate chaining Double hashing Linear probing Quadratic probing Question 2 5 pt Rehashing occurs when a hash table becomes too full and we must migrate to a larger table. If we have N elements, and our new table size is M. what is the Big O time of rehashing? O(M) ON+M) ON) O(Mlog N) Question 3 5 pts When sorting n records. Merge Sort has worst-case...