This preview shows page 1. Sign up to view the full content.
Unformatted text preview: program work correctly for both insertions and searches), and, if so, is it a good hash function? Function random(n) returns a random integer between 0 and n-1 inclusive. (a) h(k) = k/n where k and n are integers (b) h(k) = 1. (c) h(k) = (k + random(n)) mod n (d) h(k) = k mod n where n is a prime number Examples taken from “Data Structures”by Stubbs and Webre, 2 nd Edition, Brookes-Cole, 1989 and “A Practical Introduction to Data Structures and Algorithm Analysis:, C.A.Shaffer, Prentice-Hall, 1997 ....
View Full Document
This note was uploaded on 11/22/2010 for the course ECSE ECSE 322 taught by Professor Lowther during the Winter '04 term at McGill.
- Winter '04