(10 points: 2+1+1+6) This problem is concerned with hashing. (a) Let A = 15-1, and the...
Assume a hash table is implemented using chaining with buckets implemented using sorted linked lists. What's the worst-case time complexity of inserting a data item? (n is the size of data) Oin None of these Oina) O(nLogin) O 0(1) D Question 22 2 pts Assume a hash table is implemented using chaining with buckets implemented using binary search trees. What's the average-case time complexity of searching for a data item? Assume the size of data, n, is not much larger...
Questions for Hashing and Skiplists (a) The next two questions relate to the following hashing setup table size is 11 elements . hash keys are lower-case alphabetic strings . the hash function is h(k) code(last Letter (k)) mod 1 1 Where last Letter extracts the last letter from its input and code returns an integer representing the position of the letter in the alphabet (starting at zero). So, for example h(anna) returns 0, h(mob) returns 1 and h(noon) returns 2...
4. Hashing and Hash Tables. You need to use the ASCII table in the last page for this question. Study the following hash functions for ASCII C strings that are at least 3-char long unsigned hash1(const char, unsigned unsigned vto]+01997 return (v % m); unsigned hash2Cconst char unsigned) unsigned v-o]k(2] 877 return 1 + (v % ( -1)); (a) Given that m-, 7, compute the hash values and fill the following table (3%) String k hash1k, ) hash2(k, 7) aph...
1) Using Java. Insert the key sequence [29, 33, 1, 37, 32, 26, 48, 11 , 40, 17, 36, 12, 41, 25, 30, 23, 28, 39, 6, 43] with hashing by chaining in a hash table with size 17. Use the hash function: h(k) = k mod 17. a) Show the final table. b) Indicate at which insertion the first collision occurred. c) Indicate which index that has the longest chain.
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...
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...
3. (20 points) In open addressing with double hashing, we have h(k,i) hi(k)+ih2(k) mod m, where hi(k) and h2(k) is an auxiliary functions. In class we saw that h2(k) and m should not have any common divisors (other than 1). Explain what can go wrong if h2(k) and m have a common divisor. In particular, consider following scenario: m- 16, h(k) k mod (m/8) and h2(k)-m/2 and the keys are ranged from 0 to 15. Using this hash function, can...
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...
Please use Java, thank you! 5. Hashing 1) Insert the keys E X A M Q U S T I O N in that order into an initially empty table of M = 5 lists, using separate chaining. Use the hash function 11 k % M to transform the kth letter of the alphabet into a table index. Show the hash table after each insertion. hown in the following table Use A-1, B 2,. as 20 21 22 23 24...
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.