summaryrefslogtreecommitdiff
path: root/Assign5/table.hpp
blob: e8c6336539f5e4b069aa7bda968d641688464f80 (plain) (blame)
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
/* Header file containing definitions for the table object class. 
Also contains the NODE structure for the linked list used for 
separate chaining. NODE objects contain a key and a pointer to 
another NODE representing the next node. I created a constant 
called EMPTY that uses the int -1 to represent an empty slot in a table. 
*/
static const int EMPTY = -1;

struct NODE {
	int key;
	NODE *next;
};

class Table {
	private: 
		int tableArray[10];
		int unhashableList[10];
		bool unhashable;
		NODE *tableHeads[10];
	public:
		Table(bool);
		void hashLinear(int[]);
		void hashQuad(int[]);
		void hashDouble(int[]);
		void hashChaining(int[]);
		void printTable(bool);
};