#include #include "SeparateChaining.hh" #include "SeparateChaining.cc" // makes g++ happy using namespace std; // Simple main int main( ) { int ITEM_NOT_FOUND = -9999; HashTable H( ITEM_NOT_FOUND, 41 ); const int NUMS = 4000; const int GAP = 37; int i; cout << "Checking... (no more output means success)" << endl; for( i = GAP; i != 0; i = ( i + GAP ) % NUMS ) H.insert( i ); // cout << "Table after all the inserts" << endl; // H.printTable(); for( i = 1; i < NUMS; i += 2 ) H.remove( i ); // cout << endl << "Table after all the removes" << endl; // H.printTable(); for( i = 2; i < NUMS; i += 2 ) if( H.find( i ) != i ) cout << "Find fails " << i << " cuz found " << H.find(i); for( i = 1; i < NUMS; i += 2 ) { if( H.find( i ) != ITEM_NOT_FOUND ) cout << "OOPS!!! " << i << endl; } return 0; }