|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectDataStructures.ProbingHashTable<K,V>
DataStructures.QuadraticProbingTable<K,V>
K - the type of objects serving as keysV - the type of objects serving as valuespublic class QuadraticProbingTable<K,V>
A probing hash table implementation of a LookupTable with collisions resolved by quadratic probing.
Tables may be constructed, for example, by
LookupTable<String,Integer> t = new QuadraticProbingTable<String,Integer>();
t.add("one", 1);
t.add("two", 2);
t.add("three", 3);
To retrieve a value use for example:
try {
System.out.println(t.lookup("two"));
} catch (NoSuchElementException e) {
System.err.println(e);
}
Entries can be read in sequence as follows:
for (LookupTable.Entry<String,Integer> entry : t) {
System.out.println(entry);
}
LookupTable,
ProbingHashTable| Constructor Summary | |
|---|---|
QuadraticProbingTable()
Constructs a hash table with default initial size and load factor. |
|
QuadraticProbingTable(int size)
Constructs a hash table with specified initial size and default load factor. |
|
QuadraticProbingTable(int size,
double loadFactor)
Constructs a hash table initially capable of holding the given number of entries subject to the give loadfactor. |
|
| Method Summary |
|---|
| Methods inherited from class DataStructures.ProbingHashTable |
|---|
add, contains, isEmpty, iterator, lookup, remove, size |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QuadraticProbingTable(int size,
double loadFactor)
size - the minimum number of entries to be made initiallyloadFactor - the maximum loading before the table must grow
java.lang.IllegalArgumentException - if the specified load factor is
out of rangepublic QuadraticProbingTable(int size)
size - the minimum number of entries to be made initiallypublic QuadraticProbingTable()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||