AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.example.hash.HashtableExample.DoubleHashing< T > Class Template Reference

Collision handling by double hashing using h2
More...

+ Inheritance diagram for aud.example.hash.HashtableExample.DoubleHashing< T >:
+ Collaboration diagram for aud.example.hash.HashtableExample.DoubleHashing< T >:

Public Member Functions

 DoubleHashing (HashFunction< T > h2)
 
long newHash (SimpleHashtable< T > table, T key, long h, int count)
 Handle collision by computing a new hash value. More...
 
String toString ()
 
abstract long newHash (SimpleHashtable< T > table, T key, long h, int count)
 Handle collision by computing a new hash value. More...
 

Detailed Description

Collision handling by double hashing using h2

Definition at line 126 of file HashtableExample.java.

Constructor & Destructor Documentation

◆ DoubleHashing()

Definition at line 129 of file HashtableExample.java.

129{ h2_=h2; }

Member Function Documentation

◆ newHash()

long aud.example.hash.HashtableExample.DoubleHashing< T >.newHash ( SimpleHashtable< T >  table,
key,
long  h,
int  count 
)

Handle collision by computing a new hash value.

Parameters
tablehash table
keynew entry that is to be inserted but caused the collision
hpreviously used hash value
countiteration count for collision handling starting with 1 (=first collision)
Returns
new hash value

Reimplemented from aud.example.hash.CollisionHandler< T >.

Definition at line 132 of file HashtableExample.java.

132 {
133 long h2=h2_.hash(key);
134 return h+count*(h2!=0 ? h2 : 18014398509481951l);
135 }

◆ toString()

Definition at line 137 of file HashtableExample.java.

137 {
138 return "DoubleHahsing[h2="+h2_+"]";
139 }

The documentation for this class was generated from the following file: