Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 27.4, Problem 27.4.5CP
Program Plan Intro
Open Addressing:
- Open Addressing is a method of finding an open location in the hash table at the time of collision.
- There are several variations for open addressing such as linear probing, quadratic probing, and double hashing.
Quadratic Probing:
- Quadratic probing is one other variation of open addressing.
- It is introduced to avoid the clustering problem in linear probing.
- Quadratic probing will look at the cells at indices (k + j2) % n, for j ≥ 0, i.e., k, (k + 1) % n, (k + 4) % n, (k + 9) % n, ..., and so on.
- Starting from the initial index, quadratic probing will add an increment of 2 to k to define a search sequence.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
I need help with this question, please. Parts A and B
A.) Add the following numbers to an 11-entry hash table using linear probing to resolve collisions. Stop before adding an item that would result in α > 0.75. This means you might not use all the numbers. (Spoiler alert: you won't use them all.)
39 68 60 71 83 52 99 55 49 77 58 26 76 66 37 28
For the hash function, simply take the number mod the table size.
In 11 blanks, write the number that would end up at that entry in the table. If there is no number at that location, write empty.
B.) Add the following numbers to a 23-entry hash table using linear probing to resolve collisions. Stop before adding an item that would result in α > 0.75. This means you may not use all the numbers.
39 68 60 71 83 52 99 55 49 77 58 26 76 66 37 28
For the hash function, simply take the number mod the table size.
In 23 blanks, write the number that would end up at that entry in the table. If there is no number at that location, write…
Insert keys {10, 22, 11, 31, 24, 88, 38, 21} into an empty hash table with CAPACITY = 10 using quadratic probing (c1=0 and c2=1) to resolve collision (You shouldn't use a for/while loop except to increment the value of i for quadratic probing). Use the hash function is h(k, i) = (h’(k) + c1* i + c2* i^2) mod 10 and h’(k) = k mod 10.
Does a hash table of size m always have the same number of linked lists? I've been trying to understand the function of a hash function, but I just can't seem to get it. Give a case study to demonstrate your point.
Chapter 27 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 27.2 - Prob. 27.2.1CPCh. 27.3 - Prob. 27.3.1CPCh. 27.3 - Prob. 27.3.2CPCh. 27.3 - Prob. 27.3.3CPCh. 27.3 - Prob. 27.3.4CPCh. 27.3 - Prob. 27.3.5CPCh. 27.3 - Prob. 27.3.6CPCh. 27.3 - If N is an integer power of the power of 2, is N /...Ch. 27.3 - Prob. 27.3.8CPCh. 27.3 - Prob. 27.3.9CP
Ch. 27.4 - Prob. 27.4.1CPCh. 27.4 - Prob. 27.4.2CPCh. 27.4 - Prob. 27.4.3CPCh. 27.4 - Prob. 27.4.4CPCh. 27.4 - Prob. 27.4.5CPCh. 27.4 - Prob. 27.4.6CPCh. 27.5 - Prob. 27.5.1CPCh. 27.6 - Prob. 27.6.1CPCh. 27.6 - Prob. 27.6.2CPCh. 27.6 - Prob. 27.6.3CPCh. 27.7 - Prob. 27.7.1CPCh. 27.7 - What are the integers resulted from 32 1, 32 2,...Ch. 27.7 - Prob. 27.7.3CPCh. 27.7 - Describe how the put(key, value) method is...Ch. 27.7 - Prob. 27.7.5CPCh. 27.7 - Show the output of the following code:...Ch. 27.7 - If x is a negative int value, will x (N 1) be...Ch. 27.8 - Prob. 27.8.1CPCh. 27.8 - Prob. 27.8.2CPCh. 27.8 - Can lines 100103 in Listing 27.4 be removed?Ch. 27.8 - Prob. 27.8.4CPCh. 27 - Prob. 27.1PECh. 27 - Prob. 27.2PECh. 27 - (Modify MyHashMap with duplicate keys) Modify...Ch. 27 - Prob. 27.6PECh. 27 - Prob. 27.7PECh. 27 - Prob. 27.8PECh. 27 - Prob. 27.10PECh. 27 - Prob. 27.11PECh. 27 - (setToList) Write the following method that...Ch. 27 - (The Date class) Design a class named Date that...Ch. 27 - (The Point class) Design a class named Point that...
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
- Asap, i will rate positive for correct , else negative rate.arrow_forwardA linear probing hash table of length 10 uses the hash function h(x) = x mod 10 + 1. mod is the reminder operator. For example the h(42) = 42 mod 10 + 1 = 2 + 1 = 3 so we insert 42 in the position 3 in the array. After inserting 6 integer keys into an initially empty hash table, the array of keys is…arrow_forward4Asap please...arrow_forward
- There is a hash table of size, m = 10,000. Use the classic Mid Square Method to findout the index of the hash table where the information for key k = 9452 will be storedarrow_forwardConsider a simple hash function as "key mod 8" and a sequence of keys as 75, 89, 42, 58, 94, 38, 32, 21. What will be the final sequence if you insert those keys in an array of size 8 using linear probe.arrow_forwardIs there always the same number of linked lists in a hash table of size m? I've been trying to get my head around the purpose of hash functions without success. Justify your thesis with an example.arrow_forward
- Does a hash table of size m always have the same number of linked lists? No matter how long I try, I just can't put my finger on the function of a hash function. Give a case study to demonstrate your point.arrow_forwardDoes a hash table of size m always have the same number of linked lists? I have been trying to understand the function of a hash function for hours, but I just can't seem to get it. Provide an instance to demonstrate your point.arrow_forwardTake a look at a straightforward hash function like "key mod 8" and a series of keys like 75, 89, 42, 58, 94, 38, 32, and 21. What would the finished sequence look like if you use a linear probe to insert those keys into an 8-by-8 array?arrow_forward
- Using a hash table size of 11, modulo hash method and linear probing, what does the hash table look like (show me the 11 entries) after you add the following keys: 21, 54, 60, 43, 27, 44, 55, 66, 77. write your answer using - to represent an entry with no value Write your answer with a single space between the keys. example: 21 54 60 43 - - 27 44 55 66 77 for the 11 entriesarrow_forwardIs there a predetermined limit to the number of linked lists that may be included inside a hash table of size m? Hash functions continue to baffle me, and I have no idea how to interpret their intended use. Give an example to explain the point you're making.arrow_forwardSuppose you have a hash table of size N = 64, and you are using quadratic probing with c1 = 1 and c2 = 1. The keys in your hash are 4-digit integers (0000 through 9999) and your hash function is h(k) = (the sum of the digits in k). What are the first 4 values in the search sequence (starting with the home position) for a record with key k=1948? Blank # 1 Blank # 2 Blank # 3 Blank # 4arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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