CPSC 335 - PowerPoint PPT Presentation

About This Presentation
Title:

CPSC 335

Description:

A perfect hashing function maps a key into a unique address. ... What makes perfect hashing distinctive is that it is a process for mapping a key ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 9
Provided by: Fars7
Category:
Tags: cpsc | perfect

less

Transcript and Presenter's Notes

Title: CPSC 335


1
CPSC 335

Dr. Marina Gavrilova Computer Science University
of Calgary Canada
2
Outline
  • Perfect Hashing
  • Cichellis Algorithm

3
Perfect Hashing
  • A perfect hashing function maps a key into a
    unique address. If the range of potential
    addresses is the same as the number of keys, the
    function is a minimal (in space) perfect hashing
    function.
  • What makes perfect hashing distinctive is that
    it is a process for mapping a key space to a
    unique address in a smaller address space, that
    is
  • hash (key)
    unique address
  • Not only does a perfect hashing function improve
    retrieval performance, but a minimal perfect
    hashing function would provide 100 percent
    storage utilization.

4
Perfect Hashing
Process of creating a perfect hash function A
general form of a perfect hashing function is
p.hash (key) (h0(key) gh1(key)
gh2(key) mod N
5
Cichellis Algorithm
  • In Cichellis algorithm, the component
    functions are
  • h0 length (key)
  • h1
    first_character (key)
  • h2 last_character
    (key)
  • and g 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 Cichellis algorithm
    is determining T.

6
Cichellis Algorithm
Table 1 Values associated with the characters of
the Pascal reserved words
  • When we apply the Cichellis perfect hashing
    function to the keyword begin using table 1, we
    can get
  • 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.

7
Cichellis Algorithm
Cichellis algorithm for determining a perfect
hash function
8
Thank You
Write a Comment
User Comments (0)
About PowerShow.com