previous | start | next

Example 2a

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

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

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


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

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

        For a successful find

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

        Average #probes for successful find is slightly better = 10/10 = 1

     


previous | start | next