Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Consider a hash table with m = 8 slots.
a) Show the result of inserting numbers 9, 12, 2, 43, 31, 25 using a hash function h(k) = [m(kA mod 1)] for A = √3/2 with collision resolution by chaining.
b) Show the results of inserting numbers 9, 12, 2, 43, 31, 25 using open addressing with auxiliary hash function h'(k) = [m(kA mod 1)] for A = √3/2 and linear probing. How many probes are needed in this open-addressing cache to determine that 38 isn't in the hash? Explain your answers.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 2. Give the use of a hash function, Draw the hash table that results using the hash function: hik)-k mod 13 to hash the keys 2. 7.4, 41, 15, 32. 25, 11, 30. Assuming collisions are handled by Quadratic probing. 3. Draw the hash table that results using the hash function: h(k)-k mod 13 to hash the keys 2,7,4, 41, 15, 32, 25. 11, 30. Assuming collisions are handled by Linear probing 4. Draw the hash table that results using the hash function: h(k)-kmod7 to hash the keys 76. 93. 40, 47, 10. 55. Assuming collisions are handied by Double hashing.arrow_forwardConsider Cuckoo hashing with a hash table H[0...10] and the two hash functions: h₁(x) = (x + 2) mod 11 h₂(x) = (4x + 1) mod 11. (When inserting, try h₁ first.) Consider the following sequence of operations: Insert(11) Insert(13) Insert(33) Insert(27) Insert(7) Insert(24) What element is at H[9]? 11 O) 13 33 27 7 24 Unknown since it results in a rehash.arrow_forwardGiven a sequence of 5 keys < 53, 66, 32, 41, 88 > for searching task: a) Given the hash function H(k) = (3.k) mod 7, insert the keys above according to its original order (from left to right) into a hash table of 7 slots. Indicate the cases of collision. Clearly show the steps and calculation with a table. b) In case of any collisions found above in a) part, determine the new slot for each collided case using Linear Probing to solve the collision problem. Clearly show your answer for each identified case. No step of calculation required. o (Answer with “NO collision found”, in case there is no collisions found above) c) In case of any collisions found above in a) part, determine the new slot ONLY for the first collided case using Double-Hashing (with functions below) to solve the collision problem. Clearly show the steps of your calculation. d1 = H(k) = (3.k) mod 7 di = (di−1 + ((5·k) mod 6) + 1) mod 7 , i ≥ 2 o (Answer with “NO collision found”, in case there is no collisions…arrow_forward
- Insert the following sequence of keys in the hash table.Keys = {4, 2, 1, 3, 5, 6, 8}Use linear probing technique for collision resolution: h(k, i) = [h(k) + i] mod mHash function, h(k) = 3k + 1Table size, M = 10 Draw the hash table, compute the index where the hashvalue will be inserted for each key, and show how you would use the technique when a collisionoccurs.arrow_forward2. Consider the Linear Hashing index. Linear Hashing | h1 000 001 010 011 ho ठ 00 01 10 11 Mod 8 (%68) Mod 4 (%4) 16* 21* 40* 37* 14* 18* 6* Primary Page 13* A. Show the resulting index after inserting the entry 9* C. Show the resulting index after inserting entry 7* 31* 19* 11* 23* B. Show the resulting index after inserting the entry 3* 30* D. Show the resulting index after inserting the entry 22* Overflow Pagearrow_forwardConsider a hash table of capacity 5 that uses open addressing with linear probing. This hash table uses a hash function that takes the remainder when the hash code of a string is divided by the capacity of the hash table. (For example, "air" hashes 0.) The hashCode method has been overridden for strings, which simply returns 0 if a string begins with 'a', 1 if it begins with 'b', etc. /** Returns 0 if a String begins with 'a', 1 if it begins with 'b', etc. */ public int hashCode() { return this.charAt(0) - 'a'; } Assume that "apple", and "butter" have been inserted in this order into the hash table. "fig" is to be inserted into the hash table. (a) Which array slot/index should "fig" be placed? Answer: (b) What is the load factor after "fig" is inserted into the hash table? Answer:arrow_forward
- With Hash tables we have chaining and open addressing. What are the algorithms for both?how you would insert or search a hash table under either approach? Please give me examples of how I would code these algorithmsarrow_forward1) Suppose hashing is being done by using open addressing with linear probing. The hash function tobe used for an element with key k is h(k) = k mod 11. Show the contents of the hash table afterinserting the following keys in order into the hash table:27 40 22 15 31 18 36 19 20arrow_forwardSuppose we want to store a set S of n keys in a hash table T with size m, with m = n + 2, and a hash function that behaves uniformly. Should we resolve collisions with chaining or with open- addressing? Please explain why.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education