Give a Hashtable with the Size of 11 for the Keys:
11,0,16,45,22,5,33,1
Add the Keys with Brents Algorithm in a empty Table.
So you use h(k) = k mod 11 and h’(k) = 1 + ( mod 7) | explain all
steps of your solution (1st Step 2nd Step …)
I = h(k)
B= [ h(k) – h’(k) ] mod m
B’= [ h(k) – h’(k’[i]) ] mod m
Give a Hashtable with the Size of 11 for the Keys: 11,0,16,45,22,5,33,1 Add the Keys with...
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,...
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...
I) Problem solving manually (Keys are considered from left to right for the insertion, deletion and etc.) (Must show all the intermediate process leading to a solution.) 1. Consider inserting the keys 12, 28, 31. 7. 15. 17. 66, 59, 21, 3, 1 into a hash table of length m = 5 using separate chaining where h(k) = k mod m. Illustrate the result of inserting these keys.
DATA STRUCTURE: Draw the structure that results from inserting the following numerical keys into each of the structures given, starting from an empty structure. Keys: 17 29 25 48 9 36 3 31 (a) Heap (min heap) (b) Hash table of size 11, using double hashing with primary hash function h(x) =x mod 11 and secondary hash function d(x) = 5 − (x mod 5) (c) AVL Tree
Let T be a heap storing n keys. Give an efficient algorithm for
reporting all
the keys in T that are smaller than or equal to a given query key x
(which is
not necessarily in T). For example, given the heap of Figure 5.6
and query key
x = 7, the algorithm should report 4, 5, 6, 7. Note that the keys
do not need to be
reported in sorted order. Ideally, your algorithm should run in
O(k) time,...
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...
Let 'M' denote the hash table size. Consider the following four different hash table implementations: a. Implementation (I) uses chaining, and the hash function is hash(x)x mod M. Assume that this implementation maintains a sorted list of the elements (from biggest to smallest) for each chain. b. Implementation (II) uses open addressing by Linear probing, and the hash function is ht(x) - (hash(x) + f(i)) mod M, where hash(x)x mod M, and f(i)- c. Implementation (III) uses open addressing by...
5. Define Minimum Tree minimum spanin Spanning Tree (2 pts), lustrate Kruskal's algorithm to draw the tree for the graph shown below: (8 pts) 8 7 6 1 (19 pts) 6. Given the following keys: 7, 16, 4, 40, 32 Use hash function, h(k)-k mod m and create a hash table of size 11. Use Quadratic Probing method to resolve the collision. Take C1 1, and C2-2
Java you are required to add a public Object get( Object key) method into the Hashtable class. As defined in the Java documentation, the get() method returns the value with which the specified key is associated, or null if this hash table contains no record for the key. More formally, if this hash table contains a mapping from a key k to a value v such that (key.equals(k)), then this method returns v; otherwise it returns null. (There can be...
4 Let the set of all possible keys considered is the set of all integers from 0 to 10,000 inclusive. Consider a closed hashing and a hash table of size M 10 and the hash function h(x) xmod 10. Note: Using a prime number as the size of the table is not a good idea. However, we do so to keep the calculations simple. a) Write an algorithm (using any programming language) to find the largest value in this hash...