#include "utility.h" #include "key.h" #include #include #include "iomanip" using namespace std; int FlipDigits(int i); int mod (int x, int hashtablesize); double Hash_Search(int a, int b, list hashtable[]); void Hash_LoadUp(int a, int b, list hashtable[]); list hashtable[97]; list::iterator current; Key tempkey; int temp; int Hash_Table[750]; int hashtablesize=97; const int HASHTABLE_SIZE1 = 97; const int HASHTABLE_SIZE2 = 241; double Sucessful_comparisons = 0; double Unsucessful_comparisons = 0; int FlipDigits(int value) { int array[4]; array[0] = value % 10; array[1] = ((value - array[0]) / 10) % 10; array[2] = (((value - (array[0] + array[1] * 10)) / 100) % 10); array[3] = (value-(array[0] + array[1] * 10 + array[2] * 100)) / 1000; return ((array[0] * 100) + (array[1] * 1000) + (array[2]) + (array[3] * 10)); } int mod(int x, int hashtablesize) { return (x % hashtablesize); } double Hash_Search(int a, int b, list hashtable[]) { for (int x=a; x hashtable[]) { for(int i=a; i>Hash_Table[i]; } File_input.close(); cout<<"Searching hash table size of 97, and with values from lab6a.txt" << endl; cout<<"Unsuccessful searches with 100 values from end of 300 value list" << endl; cout<<"Successful searches with first 20, 50, 100, 200 elements" << endl << endl; Key::comparisons=0; Hash_LoadUp(0,20,hashtable); //hash size 20 Key::comparisons=0; cout<<"loadfactor --- unsuccessful---successful\n";\ cout<<"20(.2)" < hashtable2[241]; //new bigger hash table File_input.open("lab6b.txt"); for(int i=0; i<750; i++) //load up all the values in the file { File_input>>Hash_Table[i]; } File_input.close(); Key::comparisons=0; Hash_LoadUp(0,50, hashtable2); //hash tablesize 50 cout<<"loadfactor --- unsuccessful---successful\n";\ cout<