2.Mid Square
method: If the mid
square method, the key
squared or the
mid part of
the is used
as the index.If the key
is string it
has to be
preprocessed to produce a
number.
|
Example:
Consider
the size of
hash table is
1000 and if
we want to
place a record
3111 then key
has to be
squared and the
result is the
middle part.
(key)2=result(mid
part of the
result)
(3111)2 =9678321
Therefore,
H(3111)=783(the middle 3
digits of the
result)
At
783 location in the
hash table the
record 3111 will be
placed.Dictionaries:
Hash Table Representation
Types of Hash Function
No comments:
Post a Comment