TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
An implementation of hash table using linear 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) |
Hash a key. Uses the STL library's std::hash() function. | |
int | linearProbe (int key, bool searching) |
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 linear probing algorithm.
void linear_probing::add | ( | int | key | ) |
Adds entry using linear probing. Checks for load factor here
key | key value to hash and add |
Definition at line 161 of file linear_probing_hash_table.cpp.
void linear_probing::addInfo | ( | int | key | ) |
Information about the adding process
key | key value to hash and add |
Definition at line 186 of file linear_probing_hash_table.cpp.
void linear_probing::display | ( | ) |
Function to displays the table
Definition at line 120 of file linear_probing_hash_table.cpp.
size_t linear_probing::hashFxn | ( | int | key | ) |
Hash a key. Uses the STL library's std::hash()
function.
key | value to hash |
Definition at line 46 of file linear_probing_hash_table.cpp.
int linear_probing::linearProbe | ( | int | key, |
bool | searching ) |
Performs linear probing to resolve collisions
key | key value to hash |
Definition at line 55 of file linear_probing_hash_table.cpp.
bool linear_probing::putProber | ( | const Entry & | entry, |
int | key ) |
Finds empty spot
entry | instance to check in |
key | key value to hash |
Definition at line 98 of file linear_probing_hash_table.cpp.
void linear_probing::rehash | ( | ) |
Rehashes the table into a bigger table
Definition at line 138 of file linear_probing_hash_table.cpp.
void linear_probing::removalInfo | ( | int | key | ) |
Information about removal process
key | key value to hash and remove |
Definition at line 201 of file linear_probing_hash_table.cpp.
void linear_probing::remove | ( | int | key | ) |
Removes key. Leaves tombstone upon removal.
key | key value to hash and remove |
Definition at line 173 of file linear_probing_hash_table.cpp.
bool linear_probing::searchingProber | ( | const Entry & | entry, |
int | key ) |
Looks for a matching key
entry | instance to check in |
key | key value to hash |
Definition at line 110 of file linear_probing_hash_table.cpp.
int linear_probing::notPresent |
Definition at line 27 of file linear_probing_hash_table.cpp.
bool linear_probing::rehashing |
Definition at line 32 of file linear_probing_hash_table.cpp.
int linear_probing::size |
Definition at line 31 of file linear_probing_hash_table.cpp.
std::vector<Entry> linear_probing::table |
Definition at line 28 of file linear_probing_hash_table.cpp.
int linear_probing::tomb = -1 |
Definition at line 30 of file linear_probing_hash_table.cpp.
int linear_probing::totalSize |
Definition at line 29 of file linear_probing_hash_table.cpp.