A hash table is a very important data structure in computer science. It is used for fast information retrieval. It
stores data as a < key, value > pair, where the value is indexed by the key. Note that keys must ne unique.
Consider the example of storing persons name using the social security number (ssn) as the key. For each
ssn x, a hash function h is used, where h(x) is the location to store the name of x. Once we have created a
table, to look up the name for ssn x, we can recomputes h(x) and then look up what is stored in that location.
In Python, dictionaries are based on hash tables. Typically, the hash function h is deterministic; we do not
want to get different results every time we compute h(x). But h is often chosen to be pseudo-random. For
this problem, we will assume that h is truly random. Suppose there are k people, with each person’s name
stored in a random location (independently), represented by an integer between 1 and n, k < n. It may
happen that one location has more than one name stored there, if two different people ssns x and y end up
with the same random location for their name to be stored.
1. What is the expected number of locations with no name stored?
2. What is the expected number with exactly one name?
3. What is the expected number with more than one name?
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- 12) Chain Length Homework If N items are inserted into a hash table of size H, what is the expected average chain length?arrow_forwardExtendible hash index:Consider the Extendible Hashing index shown in figure below: Show the state of the index after each operation:a) Insertion of entry 1b) Insertion of entry 23c) Deletion of entry 30 draw the figures separately for a, b and carrow_forwardDoes a hash table of size m consistently contain the same number of linked lists? I am unable to identify the purpose of a hash function, no matter how hard I attempt. To demonstrate your thesis, provide an example.arrow_forward
- All of these statements are related to hash function, hash table.arrow_forwardWe are using a subpar hash map, where each value is accumulated in a single container. A hash map has successfully achieved its purpose.arrow_forwardLinear hash index:Consider the Extendible Hashing index shown in figure below.A bucket is split each time an overflow page gets created Show the state of the index after each operation:a) Insertion of entry 2b) Insertion of entry 40c) Insertion of entry 39arrow_forward
- A hash-map has been constructed with quadratic-hashing. The hashing function is h(k;) = (3 * k; + 7) mod 17 and the table length is N = 17. How many cells will be probed by the call of insert(2) 1 4 5 6 7 8 10 11 12 13 14 15 16 26 89 11 35 70 59 Note: First row contains the indices and the second row contains the items.arrow_forwardConsider a open bucket hash table and closed bucket hash table in which the keys are student identifiers (strings of 6 digits). Assume the following number of buckets and hash function: m = 100; hash(id) = first two digits of id #. Starting with an empty hash table, show the effect of successively adding the following student identifiers: 000014, 990021, 990019, 970036, 000015, 970012, 970023. Use following function as second hash function hash(id) = last digit of id # Show the effect of deleting 000014 from the hash table. (Java Programming DSA)arrow_forwardThe Java hash function for Strings computes a hash code based on a fixed maximum number of characters of the string. Given that Strings have no meaningful upper bound in length, describe how an effective, constant-time hashing algorithm can be constructed. (Hint: If you were to pick, say, eight characters to represent a string of length l, which would you choose?)arrow_forward
- Suppose we were supplied a hash function h(k) = k mod 10. Let our hash table T consist of a modest 10 slots, addressed by index values 0 through 9: and the remaining part is continued in the imagearrow_forwardAssume that linear probing is used for hash-tables. To improve the time complexity of the operations performed on the table, a special AVAILABLE object is used to mark a location when an item is removed from the location. Assuming that all keys are positive integers, the following two techniques were suggested instead of marking the location as AVAILABLE: i) When an entry is removed, instead of marking its location in the table as AVAILABLE, indicate the key in the location as the negative value of the removed key (e.g., if the removed key was 16, indicate the key as -16). Searching for an entry with the removed key would then terminate once a negative value of the key is found (instead of continuing to search if AVAILABLE is used). ii) Instead of using AVAILABLE, find a key in the table that should have been placed in the location of the removed entry, then place that key (the entire entry of course) in that location (instead of setting the location as AVAILABLE). The motive is to…arrow_forwardANSWER ALL QUESTIONSarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education