#include<iostream>
#include<string>
#include<fstream>

#include"HashTable.h"

using namespace std;

int main() {

	ifstream ifs("//Engr_asu/Ece352/words");
	string word;
	string abba = "zoom";
	ofstream out("output");
	for (double d = .1; d< .99; d+= .1){
		cout << "Rehasing when lambda >= " << d << endl;
		out << d << "\t";
		cout << "Quadratic: ";
		HashTable<string> t(d);	
		while (ifs >> word) {
			t.insert(word);
		};
		out << t.getSize() << "\t" << t.getCapacity() << "\t" <<
			t.getLambda() << "\t" << t.getLookups() << "\t";
		cout << "Size= " << t.getSize();
		cout << " Capacity= " << t.getCapacity();
		cout << " Lambda= " << t.getLambda();
		cout << " Lookups= " << t.getLookups();
		cout << " Abba= " << t.findPos(abba) << endl;
		ifs.clear();
		ifs.seekg(0);
	
		cout << "Linear: ";
		ifstream ifs2("//Engr_asu/Ece352/words");
		LinearHashTable<string> t2(d);
		while (ifs2 >> word){
			t2.insert(word);
		};
		out << t2.getSize() << "\t" << t2.getCapacity() << "\t" <<
			t2.getLambda() << "\t" << t2.getLookups() << "\t" << endl;
		cout << "Size= " << t2.getSize();
		cout << " Capacity= " << t2.getCapacity();
		cout << " Lambda = " << t2.getLambda();
		cout << " Lookups = " << t2.getLookups();
		cout << " Abba = " << t.findPos(abba) << endl;
		ifs2.clear();
		ifs2.seekg(0);
	}
	out.close();
	return 0;

}