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

Collision handling by quadratic probing h(x,i)=h(x)+i*b+i*i*c
More...

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

Public Member Functions

 QuadraticProbing ()
 
 QuadraticProbing (int b, int c)
 
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 quadratic probing h(x,i)=h(x)+i*b+i*i*c

Definition at line 104 of file HashtableExample.java.

Constructor & Destructor Documentation

◆ QuadraticProbing() [1/2]

◆ QuadraticProbing() [2/2]

Definition at line 108 of file HashtableExample.java.

108 {
109 this();
110 assert(b>=0 && c>0);
111 b_=b;
112 c_=c;
113 }

Member Function Documentation

◆ newHash()

long aud.example.hash.HashtableExample.QuadraticProbing< 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 116 of file HashtableExample.java.

116 {
117 return h + count*b_ + (count*count)*c_;
118 }

◆ toString()

Definition at line 120 of file HashtableExample.java.

120 {
121 return "QuadraticProbing[b="+b_+", c="+c_+"]";
122 }

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