-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashTable.h
More file actions
42 lines (35 loc) · 714 Bytes
/
Copy pathHashTable.h
File metadata and controls
42 lines (35 loc) · 714 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
33
34
35
36
37
38
39
40
41
42
// HashTable.h
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include <iostream>
// Define a Node structure for the linked list
struct Node {
int value;
Node* next;
Node(int val);
};
// Define a simple linked list class
class LinkedList {
public:
Node* head;
LinkedList();
~LinkedList();
void push_back(int number);
bool contains(int number);
};
// HashTable class declaration
class HashTable {
private:
LinkedList* table;
int capacity;
int currentSize;
public:
HashTable(int initialCapacity);
~HashTable();
int hashFunction(int key);
int getSize();
char* search(int number);
bool insert(int number);
void rehash();
};
#endif // HASHTABLE_H