![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Base class for simple hash tables (mainly for demonstration). More...
Public Member Functions | |
SimpleHashtable (int size, HashFunction< T > hash, CollisionHandler< T > onCollision) | |
create new hash table More... | |
int | getNumEntries () |
get number of entries More... | |
int | getTableSize () |
get size of hash table More... | |
float | getLoadFactor () |
get load factor More... | |
String | toString () |
void | beginRecording () |
start recording of history More... | |
void | nextTimeStep () |
advance one time step in history, e.g., after every insert More... | |
SVGViewer | showHistory () |
show history More... | |
Static Public Member Functions | |
static void | main (String args[]) |
Base class for simple hash tables (mainly for demonstration).
Note:This class is intended to visualize hash tables, it is not an efficient or particularly useful implementation of a hash table!
<T> | table entry |
Definition at line 17 of file SimpleHashtable.java.
aud.example.hash.SimpleHashtable< T >.SimpleHashtable | ( | int | size, |
HashFunction< T > | hash, | ||
CollisionHandler< T > | onCollision | ||
) |
create new hash table
size | size of table (could be any "bad" size, "good" sizes are prime) |
hash | hash function |
onCollision | strategy for collision handling, a value null forces separate chaining |
Definition at line 49 of file SimpleHashtable.java.
void aud.example.hash.SimpleHashtable< T >.beginRecording | ( | ) |
start recording of history
Definition at line 154 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.main().
float aud.example.hash.SimpleHashtable< T >.getLoadFactor | ( | ) |
get load factor
Definition at line 67 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.toString().
int aud.example.hash.SimpleHashtable< T >.getNumEntries | ( | ) |
get number of entries
Definition at line 61 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.toString().
int aud.example.hash.SimpleHashtable< T >.getTableSize | ( | ) |
get size of hash table
Definition at line 64 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.toString().
|
static |
Definition at line 186 of file SimpleHashtable.java.
References aud.example.hash.SimpleHashtable< T >.beginRecording(), aud.example.hash.SimpleHashtable< T >.nextTimeStep(), and aud.example.hash.SimpleHashtable< T >.showHistory().
void aud.example.hash.SimpleHashtable< T >.nextTimeStep | ( | ) |
advance one time step in history, e.g., after every insert
Definition at line 167 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.main().
SVGViewer aud.example.hash.SimpleHashtable< T >.showHistory | ( | ) |
show history
Definition at line 179 of file SimpleHashtable.java.
Referenced by aud.example.hash.SimpleHashtable< T >.main().
String aud.example.hash.SimpleHashtable< T >.toString | ( | ) |
Definition at line 130 of file SimpleHashtable.java.
References aud.example.hash.SimpleHashtable< T >.getLoadFactor(), aud.example.hash.SimpleHashtable< T >.getNumEntries(), and aud.example.hash.SimpleHashtable< T >.getTableSize().