One simple way to resolve collisions in an array implementation is to use linear probing. That is, just try the next position:
hash(14913) = 14913 % 7 = 3 hash(15930) = 15930 % 7 = 5 hash(16918) = 16918 % 7 = 6 hash(17020) = 17020 % 7 = 3 ----------- 0 null 1 null 2 null 3 (14913, 20) (17020, 19) goes in next available spot 4 (17020, 19) 5 (15930, 10) 6 (16918, 50) How many comparisons must be made now, to look up key 14913? What about key 17020? Where would (14920, 40) go? hash(14920) = 14920 % 7 = 3 Answer: Position 0; that is, next available just wraps around to the beginning of the array if necessary.