CPSC 319. Dr. Marina Gavrilova Computer Science University of Calgary Canada. Perfect Hashing Cichelli’s Algorithm. Outline. Perfect Hashing.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Dr. Marina Gavrilova
University of Calgary
hash (key) unique address
Process of creating a perfect hash function
A general form of a perfect hashing function is:
p.hash (key) =(h0(key) + g[h1(key)] + g[h2(key)] mod N
h0 = length (key)
h1 = first_character (key)
h2 = last_character (key)
andg = T (x)
where T is the table of values associated with individual characters x which may apply in a key.
The time consuming part of Cichelli’s algorithm is determining T.
Table 1: Values associated with the characters of the Pascal reserved words
The keyword begin would be stored in location 33. Since the hash values run from 2 through 37 for this set of data, the hash function is a minimal perfect hashing function.