Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Chain class with a given modulus. More...
Public Member Functions | |
hash_chain (int mod) | |
Construct a new chain object. | |
void | add (int x, int h) |
create and add a new node with a give value and at a given height | |
void | display () |
Display the chain. | |
virtual int | hash (int x) const |
Compute the hash of a value for current chain. | |
bool | find (int x, int h) const |
Find if a value and corresponding hash exist. | |
Private Types | |
using | Node |
Define a linked node. | |
Private Attributes | |
std::vector< std::shared_ptr< Node > > | head |
array of nodes | |
int | _mod |
modulus of the class | |
Chain class with a given modulus.
|
private |
|
inlineexplicit |
Construct a new chain object.
mod | modulus of the chain |
|
inline |
create and add a new node with a give value and at a given height
x | value at the new node |
h | height of the node |
|
inline |
|
inline |
Find if a value and corresponding hash exist.
x | value to search for |
h | corresponding hash key |
true
if element found false
if element not found
|
inlinevirtual |