previous | start | next

Example

Using the same example as for linear probing:

        hash(14913) = 14913 % 7 = 3
        hash(15930) = 15930 % 7 = 5
        hash(16918) = 16918 % 7 = 6
        hash(17020) = 17020 % 7 = 3
        hash(14920) = 14920 % 7 = 3
        -----------
        0 null
        1 null
        2 null
        3 -----> (14913, 20) --> (17020,19) --> (14920,40)
        4 null
        5 -----> (15930, 10)
        6 -----> (16918, 50)

        Collisions are all on the same list. So lookup of 14920 only requires
        3 probes instead of 5; no values that hash to a different value are
        are involved unlike linear probing.

        Key     Number of Probes to Lookup
        14913         1
        15930         1
        16918         1
        17020         2
        14920         3
        ------
        8

        Average #probes (comparisons) to lookup a value which is present

        8/5 = 1.6

     


previous | start | next