Sunday 10 October 2010

Multiplicative Hash Functon





The   given   is  multiplied  with  some  constant  value.
The   formula   for  computing   the  hash  key  is
      H(Key)=floor(p*(fractional part  of  key  *A))
 
 

Where     p  is  integer  constant  and
                A   is  constant   real  number
Donald   Knuth  suggested  to  use  constant  A=0.61803398987
Example:  
If   key  is  107   and  p=50  then
                         H(key)=floor(50*(107*0.61803398987))
                                    =floor(3306.4818458045)
                                   =3306
At    3306   location   in the  hash   table   the  record    107   will be   placed.
 



Types  of   Hash  Function

No comments:

Post a Comment