50 Entry(
unsigned long k,
unsigned long v)
68 const unsigned long numNodes = 10000;
74 unsigned int t = std::time(
NULL);
79 n = std::stoul(
argv[1]);
82 t = std::stoul(
argv[2]);
91 cout <<
"n must be positive" <<
endl;
97 cout <<
"testDynamicHash " << n <<
" " << t <<
endl;
106 cout <<
"Inserting..." <<
endl;
108 for (i = 0; i < n; i++)
116 cout << value <<
" ";
128 cout <<
endl <<
"Searching..." <<
endl;
130 for (i = 0; i < n; i++)
136 cout <<
endl <<
"Error key " <<
keys[i] <<
" not found" <<
endl;
141 cout <<
"Testing iterator" <<
endl;
147 cout << it.get_curr()->get_key() <<
" ";
152 cout <<
endl <<
"testing deleting ..." <<
endl;
156 for (i = 0; i < n; i++)
166 AH_ERROR(
"%u th key %u not found\n", (
int) i, (
int)
keys[i]);
170 catch (exception&
exc)
172 cout <<
exc.what() <<
" exception has been thrown" <<
endl;
176 cout <<
" unknown exception has been thrown" <<
endl;
#define AH_ERROR(format, args...)
Print an error message (always enabled).
Core header for the Aleph-w library.
bool has_curr() const noexcept
Return true if the iterator has current item.
Generic linear hash table.
const size_t & capacity() const noexcept
Returns the table capacity.
const size_t & size() const noexcept
Returns the number of elements in the table.
const size_t & expansions() const noexcept
Returns the expansion level performed on the table.
Bucket * remove(Bucket *bucket) noexcept
Remove bucket from table.
const size_t & busy_slots() const noexcept
Returns the number of busy slots in the table.
Bucket * insert(Bucket *bucket)
Insert bucket in the table.
Bucket * search(const Key &key) const noexcept
Search for key in the linear hash table.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Entry(unsigned long k, unsigned long v)
void print_stats(LinearHashTableVtl< unsigned long > &table)
Linear hashing with chaining.