com.mhhe.clrs2e
Class LinearProbingHashTable
java.lang.Object
|
+--com.mhhe.clrs2e.OpenAddressingHashTable
|
+--com.mhhe.clrs2e.LinearProbingHashTable
- All Implemented Interfaces:
- Dictionary
- public class LinearProbingHashTable
- extends OpenAddressingHashTable
Implements a hash table with linear probing as described on page
239 of Introduction to Algorithms, Second edition.
Constructor Summary |
LinearProbingHashTable()
Creates a new open-addressed hash table with linear probing
with 16 entries. |
LinearProbingHashTable(int size)
Creates a new open-addressed hash table with linear probing of
a given size. |
Method Summary |
protected int |
hash(java.lang.Object o,
int i)
Computes a hash function for an open-addressing hash table,
uslng linear probing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LinearProbingHashTable
public LinearProbingHashTable()
- Creates a new open-addressed hash table with linear probing
with 16 entries.
LinearProbingHashTable
public LinearProbingHashTable(int size)
- Creates a new open-addressed hash table with linear probing of
a given size.
hash
protected int hash(java.lang.Object o,
int i)
- Computes a hash function for an open-addressing hash table,
uslng linear probing.
- Specified by:
hash
in class OpenAddressingHashTable
- Parameters:
o
- An object. If the object implements
DynamicSetElement
, the hash value is of its key.i
- The probe number.
- Returns:
- An index into the open-addressed hash table.