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.


Field Summary
 
Fields inherited from class com.mhhe.clrs2e.OpenAddressingHashTable
m
 
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 com.mhhe.clrs2e.OpenAddressingHashTable
delete, insert, search, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.

Method Detail

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.