-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashtable.h
More file actions
35 lines (32 loc) · 693 Bytes
/
Copy pathHashtable.h
File metadata and controls
35 lines (32 loc) · 693 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
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include <iostream>
class Hashtable
{
private:
int hash(int v) const;
int htableCapacity{ 0 };
double loadFactor{ 0.0 };
int* htable{ nullptr };
int count{ 0 };
public:
Hashtable();
Hashtable(int);
Hashtable(int, double);
Hashtable(const Hashtable& other);
Hashtable& operator=(const Hashtable& other);
~Hashtable();
int size() const;
void resize();
int capacity() const;
double getLoadFactorThreshold() const;
bool empty() const;
void insert(const int);
void remove(int);
bool contains(int) const;
int indexOf(int) const;
void clear();
static bool isPrime(int n);
static int nextPrime(int n);
};
#endif