All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.SeparateChainingHashTable
java.lang.Object
|
+----DataStructures.SeparateChainingHashTable
- public class SeparateChainingHashTable
- extends Object
Separate chaining table implementation of hash tables.
Note that all "matching" is based on the equals method.
SeparateChainingHashTable()
- Construct the hash table.
SeparateChainingHashTable(int)
- Construct the hash table.
find(Hashable)
- Find an item in the hash table.
hash(String, int)
- A hash routine for String objects.
insert(Hashable)
- Insert into the hash table.
main(String[])
-
makeEmpty()
- Make the hash table logically empty.
remove(Hashable)
- Remove from the hash table.
SeparateChainingHashTable
public SeparateChainingHashTable()
- Construct the hash table.
SeparateChainingHashTable
public SeparateChainingHashTable(int size)
- Construct the hash table.
- Parameters:
- size - approximate table size.
insert
public void insert(Hashable x)
- Insert into the hash table. If the item is
already present, then do nothing.
- Parameters:
- x - the item to insert.
remove
public void remove(Hashable x)
- Remove from the hash table.
- Parameters:
- x - the item to remove.
find
public Hashable find(Hashable x)
- Find an item in the hash table.
- Parameters:
- x - the item to search for.
- Returns:
- the matching item, or null if not found.
makeEmpty
public void makeEmpty()
- Make the hash table logically empty.
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.
main
public static void main(String[] args)
All Packages Class Hierarchy This Package Previous Next Index