previous | start | next

Example 1a

        N = 10 Keys, M = 10 chains, Load Factor=1; bad hash function

        Here the average chain length is N/M = 1.

        With the "bad" hash function, increasing the chains means:


        chain          length
        0              10
        1               0
        2               0
        3               0
        4               0
        5               0
        ...             ...
        9               0

        The average chain length is now 1 instead of 2, but

        For a successful find

        key            probes
        1-st             1
        2nd              2
        3rd              3
        ...              ...
        10th             10
        ------          -----
        total                   55

        Average #probes for successful find is still = 55/10 = 5.5

     


previous | start | next