I need to calculated the runtime of a hash insertion. i have been using clock to do the time but i keep ending up with zero. Is there any certain way that would be the most efficient?
This is my code for it so far:
cout << "Testing chaining probing...\n";
HashTable_chaining ChainingHT( ITEM_NOT_FOUND, 101 );
int i = 0;
while(i != DataArray.size())
{
clock_t tStart = clock();
ChainingHT.insert(DataArray[i]);
cout<<"Time taken:"<<(double)(clock() - tStart)/100000<<endl;
if(i != NULL)
{
collision_count++;
}
i++;
}