TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
An implementation of hash table using quadratic probing algorithm. More...
Classes | |
struct | Entry |
Functions | |
bool | putProber (const Entry &entry, int key) |
bool | searchingProber (const Entry &entry, int key) |
void | add (int key) |
size_t | hashFxn (int key) |
int | quadraticProbe (int key, bool searching) |
Entry | find (int key) |
void | display () |
void | rehash () |
void | remove (int key) |
void | addInfo (int key) |
void | removalInfo (int key) |
Variables | |
int | notPresent |
std::vector< Entry > | table |
int | totalSize |
int | tomb = -1 |
int | size |
bool | rehashing |
An implementation of hash table using quadratic probing algorithm.
void quadratic_probing::add | ( | int | key | ) |
Checks for load factor here
key | key value to hash and add to table |
Definition at line 182 of file quadratic_probing_hash_table.cpp.
void quadratic_probing::addInfo | ( | int | key | ) |
Information about the adding process
key | key value to hash and add to table |
Definition at line 207 of file quadratic_probing_hash_table.cpp.
void quadratic_probing::display | ( | ) |
Displays the table
Definition at line 142 of file quadratic_probing_hash_table.cpp.
Entry quadratic_probing::find | ( | int | key | ) |
Get the entry instance corresponding to a key
key | key value to search/probe |
Definition at line 131 of file quadratic_probing_hash_table.cpp.
size_t quadratic_probing::hashFxn | ( | int | key | ) |
Hash a key
key | key value to hash |
Definition at line 46 of file quadratic_probing_hash_table.cpp.
bool quadratic_probing::putProber | ( | const Entry & | entry, |
int | key ) |
Finds empty spot
entry | Instance of table entry |
key | key value to search/probe |
true
if key is present false
if key is absent Definition at line 106 of file quadratic_probing_hash_table.cpp.
int quadratic_probing::quadraticProbe | ( | int | key, |
bool | searching ) |
Performs quadratic probing to resolve collisions
key | key value to search/probe |
searching | true if only searching, false1 if assigning @returns value of notPresent`. |
Definition at line 56 of file quadratic_probing_hash_table.cpp.
void quadratic_probing::rehash | ( | ) |
Rehashes the table into a bigger table
Definition at line 160 of file quadratic_probing_hash_table.cpp.
void quadratic_probing::removalInfo | ( | int | key | ) |
Information about removal process
key | key value to hash and remove from table |
Definition at line 222 of file quadratic_probing_hash_table.cpp.
void quadratic_probing::remove | ( | int | key | ) |
Removes key. Leaves tombstone upon removal.
key | key value to hash and remove from table |
Definition at line 194 of file quadratic_probing_hash_table.cpp.
bool quadratic_probing::searchingProber | ( | const Entry & | entry, |
int | key ) |
Looks for a matching key
entry | Instance of table entry |
key | key value to search/probe |
true
if key matches the entry false
if key does not match the entry Definition at line 119 of file quadratic_probing_hash_table.cpp.
int quadratic_probing::notPresent |
Definition at line 28 of file quadratic_probing_hash_table.cpp.
bool quadratic_probing::rehashing |
Definition at line 33 of file quadratic_probing_hash_table.cpp.
int quadratic_probing::size |
Definition at line 32 of file quadratic_probing_hash_table.cpp.
std::vector<Entry> quadratic_probing::table |
Definition at line 29 of file quadratic_probing_hash_table.cpp.
int quadratic_probing::tomb = -1 |
Definition at line 31 of file quadratic_probing_hash_table.cpp.
int quadratic_probing::totalSize |
Definition at line 30 of file quadratic_probing_hash_table.cpp.