Question

In: Computer Science

Please review the hash technique. I give you this phrase : If quadratic probing is used,...

Please review the hash technique. I give you this phrase : If quadratic probing is used, and the table size is prime, then a new element can always be inserted if the table is at least half empty. If you disagree with this phrase, please give or provide a counter example to prove that it is in fact an incorrect statement. However, if you think that is it right, please show your reasoning behind it and prove it. Please type answer if you can

Solutions

Expert Solution

About Quadratic Probing:

  • If the table is even one more than half full, the insertion could fail (although this is extremely unlikely).
  • It is also crucial that the table size be prime.
  • If the table size is not prime, the number of alternate locations can be severely reduced.
  • Standard deletion cannot be performed in a closed hash table, because the cell might have caused a collision to go past it.
  • Closed hash tables require lazy deletion.

Let's see why this is the case, using a proof by contradiction.

  1. Say that the theorem is wrong. Then that means there are two values a and b such that 0 <= a < b < floor[M/2] that probe the same position.

  2. h_a(q) and h_b(q) must probe the same position, by (1), so h_a(q) = h_b(q).

  3. h_a(q) = h_b(q) ==> h(q) + c(a) = h(q) + c(b), mod M.

  4. The h(q) on both sides cancel. Our c(i) is just c(i) = i^2, so we have a^2 = b^2.

  5. Solving the quadratic equation in (4) gives us a^2 - b^2 = 0, mod M. This is a difference of two squares, so the solution is (a - b)(a + b) = 0, mod M.

  6. But remember, we said M was a prime number. The only way that (a - b)(a + b) can be zero mod M is if [case I] (a - b) is zero, or [case II] (a + b) is zero mod M.

  7. Case I can't be right, because we said that a != b, so a - b must be something other than zero.

  8. The only way for (a + b) to be zero mod M is for a + b to be equal to be a multiple of M or zero. They clearly can't be zero, since they're both bigger than zero. And since they're both less than floor[M/2], their sum must be less than M. So case II can't be right either.

Thus, if the theorem were wrong, one of two quantities must be zero, neither of which can possibly be zero -- a contradiction! QED: quadratic probing doesn't satisfy property two once your table is more than half full and if your table size is a prime number. The proof is complete!


Related Solutions

Can someone please write me a header file in c++ using the quadratic probing hash method...
Can someone please write me a header file in c++ using the quadratic probing hash method that will work with this program? #include "hash.h" #include <algorithm> #include <cstdlib> #include <ctime> #include <iostream> #include <list> using namespace std; const size_t KEYS_COUNT = 1000; // Number of keys to generate for testing string random_key(); class HashCheck { private: size_t count; Hash hash; public: HashCheck(Hash& h) { count = 0; hash = h; } void operator() (const string key) { if (hash[key] !=...
literature review on hybrid cloud with refrences. please give it in detail. please do as i...
literature review on hybrid cloud with refrences. please give it in detail. please do as i asked there has been people answering randomly.
how do you linearize a function that has a square root, quadratic, and inverse? please give...
how do you linearize a function that has a square root, quadratic, and inverse? please give examples of commonly used physics formula with each of these characteristics
please give me true answer only quickly Which therapeutic communication technique is being used in this...
please give me true answer only quickly Which therapeutic communication technique is being used in this nurse-client interaction? Client: “When I get angry, I get into a fistfight with my wife or I take it out on the kids.” Nurse: “I notice that you are smiling as you talk about this physical violence.” Making observations Exploring Encouraging comparison Formulating a plan of action Which of the following statements is true regarding child abuse?                     None of...
Please explain and give an example: Solving linear and quadratic equations. Please type answer do not...
Please explain and give an example: Solving linear and quadratic equations. Please type answer do not hand write. Thank you.
C++ only please Description A hash table is a data structure that is used to store...
C++ only please Description A hash table is a data structure that is used to store keys/value pairs. It is perfect to use when you have a large amount of directory-type information and the operations you need to perform are to insert, delete, print, and search. I am giving you all a lot more freedom in this program in that the value held in your hash table can be a pointer to any object created from your own custom class....
Respond to this discussion, what feed back could you give? Correlation is a statistical technique used...
Respond to this discussion, what feed back could you give? Correlation is a statistical technique used to determine the relationship between two or more variables (Thomas, Nelson, & Silverman, 2015). This is a way to determine if there are positive or negative relationships between variables in research. For example, if someone were to research the effect of different amounts of creatine monohydrate supplementation in high school athletes, they may notice a correlation between the amounts of supplementation and the athletes...
The typical cost function is quadratic. how could that then be estimated through regression? please give...
The typical cost function is quadratic. how could that then be estimated through regression? please give an example
I have to write a review paper of one measurement technique (any device you feel interested in or have experience with)
 I have to write a review paper of one measurement technique (any device you feel interested in or have experience with), which could be what I have learned in Mechanical Measurement course.The main content should include how it operates, its application, changes in design with time, and future direction. Although I have to focus on recent and future development. Would you give me any examples of devices or suggest essay topics ?  
Review the Comprehensive Annual Financial Report (CAFR) that you obtained. The city I need to used...
Review the Comprehensive Annual Financial Report (CAFR) that you obtained. The city I need to used to complete this section is Columbia County, Georgia 2019 How does the government classify its governmental expenditures, by function or by “object”? Are the classifications approximately the same in both the government‐wide and the fund statements? What was the city's largest expenditure for fiscal year 2017? By how much did this increase or decrease since FY 2016? Since FY 2012 (see statistical section)? Can...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT