Given a hash function . Let . There are probing sequences because there are different starting points for the probing and any two probes starting from the same point will have the same sequence. While linear probing is simple and takes less time, there is the problem of primary clustering.Quadratic probing
Let . There are probing sequences because there are different starting points for the probing and any two probes starting from the same point will have the same sequence. Like linear probing, quadratic probing is simple. However, while it avoids the primary clustering problem, there is a problem of secondary clustering.Double hashing
There are probing sequences because each possible pair yields a distinct probe sequence. As we vary the key, the initial probe position and offset may vary independently. Double hashing is an ideal hashing approach. It prevents both primary and secondary clustering problems. However, it is more complicated and requires more running time for hashing.
def sift_up(A, j): i = j while i > 1 and A[i] has priority over A[P(i)]: swap A[i] and A[P(i)] i = P(i)SIFT-UP has a runtime of . At the swapping step, we do not need to be concerned about the key of the sibling as has priority over the sibling. Hence, if has priority over , then must have priority over its sibling too.