-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSeparateChaining.cpp
More file actions
32 lines (25 loc) · 894 Bytes
/
TestSeparateChaining.cpp
File metadata and controls
32 lines (25 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream.h>
#include "SeparateChaining.h"
// Simple main
int main( )
{
int ITEM_NOT_FOUND = -9999;
HashTable<int> H( ITEM_NOT_FOUND );
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 );
for( i = 1; i < NUMS; i += 2 )
H.remove( i );
for( i = 2; i < NUMS; i += 2 )
if( H.find( i ) != i )
cout << "Find fails " << i << endl;
for( i = 1; i < NUMS; i += 2 )
{
if( H.find( i ) != ITEM_NOT_FOUND )
cout << "OOPS!!! " << i << endl;
}
return 0;
}