All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class DataStructures.QuadraticProbingHashTable

java.lang.Object
    |
    +----DataStructures.QuadraticProbingHashTable

public class QuadraticProbingHashTable
extends Object
Probing table implementation of hash tables. Note that all "matching" is based on the equals method.


Constructor Index

 o QuadraticProbingHashTable()
Construct the hash table.
 o QuadraticProbingHashTable(int)
Construct the hash table.

Method Index

 o find(Hashable)
Find an item in the hash table.
 o hash(String, int)
A hash routine for String objects.
 o insert(Hashable)
Insert into the hash table.
 o main(String[])
 o makeEmpty()
Make the hash table logically empty.
 o remove(Hashable)
Remove from the hash table.

Constructors

 o QuadraticProbingHashTable
public QuadraticProbingHashTable()
Construct the hash table.

 o QuadraticProbingHashTable
public QuadraticProbingHashTable(int size)
Construct the hash table.

Parameters:
size - the approximate initial size.

Methods

 o insert
public void insert(Hashable x)
Insert into the hash table. If the item is already present, do nothing.

Parameters:
x - the item to insert.
 o remove
public void remove(Hashable x)
Remove from the hash table.

Parameters:
x - the item to remove.
 o find
public Hashable find(Hashable x)
Find an item in the hash table.

Parameters:
x - the item to search for.
Returns:
the matching item.
 o makeEmpty
public void makeEmpty()
Make the hash table logically empty.

 o hash
public static int hash(String key,
                       int tableSize)
A hash routine for String objects.

Parameters:
key - the String to hash.
tableSize - the size of the hash table.
Returns:
the hash value.
 o main
public static void main(String[] args)

All Packages  Class Hierarchy  This Package  Previous  Next  Index