Limitations
For linear probing it is a bad idea to let the hash table get nearly full, because performance is degraded as the hash table gets filled. In the case of quadratic probing, the situation is even more drastic. With the exception of the triangular number case for a power-of-two-sized hash table, there is no guarantee of finding an empty cell once the table gets more than half full, or even before the table gets half full if the table size is not prime. This is because at most half of the table can be used as alternative locations to resolve collisions. If the hash table size is b (a prime greater than 3), it can be proven that the first alternative locations including the initial location h(k) are all distinct and unique. Suppose, we assume two of the alternative locations to be given by and, where 0 ≤ x, y ≤ (b / 2). If these two locations point to the same key space, but x ≠ y. Then the following would have to be true,
As b (table size) is a prime greater than 3, either (x - y) or (x + y) has to be equal to zero. Since x and y are unique, (x - y) cannot be zero. Also, since 0 ≤ x, y ≤ (b / 2), (x + y) cannot be zero.
Thus, by contradiction, it can be said that the first (b / 2) alternative locations after h(k) are unique. So an empty key space can always be found as long as at most (b / 2) locations are filled, i.e., the hash table is not more than half full.
Read more about this topic: Quadratic Probing
Famous quotes containing the word limitations:
“Growing up means letting go of the dearest megalomaniacal dreams of our childhood. Growing up means knowing they cant be fulfilled. Growing up means gaining the wisdom and skills to get what we want within the limitations imposed by realitya reality which consists of diminished powers, restricted freedoms and, with the people we love, imperfect connections.”
—Judith Viorst (20th century)
“The only rules comedy can tolerate are those of taste, and the only limitations those of libel.”
—James Thurber (18941961)
“... art transcends its limitations only by staying within them.”
—Flannery OConnor (19251964)