Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Explain how separate chaining works for a hash table. A hash table has size of 9. The hash function is h(k)= k mod 9
Explain how separate chaining works for a hash table. A hash table has size of 9. The hash function is h(k)= k mod 9 and the collisions are resolved by chaining. These 9 keys are inserted in this order: 5, 28, 19, 15, 20, 33, 12, 17, 10. What are the maximum, minimum, and average chain lengths in the hash table (in that order). ( Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020? Please explain your reasoning. A. mod 10 B. 3 mod 10 C. (111) mod 10 D. (12i) mod 10 A hashtable is implemented with open-adressing and linear probing. The hash table is designed to store strings and uses a 5-bit cyclic shift function to hash the strings. The hashing function uses the MAD (multiply-add-divide) with h(y) = [(yxa+b) mod p] mod N where the scale constant is a = 63695799, the shift b = 36103891 and the prime p and the size of the hashtable N = 11. Compute the hashcodes for the following set of entries: = 109345121, 2 3 4 5 6 7 ["binary", "search", "splay", "heap", "priority", "hashtable"] and show the structure of the hashtable after adding the entries in that order (write it as an array showing the entry at each position in the array). String []keys = {"binary", "search", "splay", "heap", "priority", "hashtable"}; Linear ProbingHashMap map = new Linear Probing HashMap (63695799, 36103891, 109345121, 11); for (String k: keys) { map.add (k, 1); } 24: Write a method dist(pi, pj) which finds the path length between two nodes in a binary tree. The distance is the shortest path length between the two nodes, and may or may not pass through the root node. You can provide pseudocode or Java. 21 28 32 29 44 54 dist (54,93) = 4 65 76 82 88 80 97 93 17 21 28 32 29 44 54 dist (21, 80) = 9 65 76 82 88 80 97 93
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The images display questions regarding hash tables and binary trees which are data structures used in computer science 1 Separate chaining is a collision resolution method in a hash table When two key...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started