-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenhash.cpp
More file actions
66 lines (50 loc) · 1.24 KB
/
openhash.cpp
File metadata and controls
66 lines (50 loc) · 1.24 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
using namespace std;
typedef struct link {
int element; // E type, value stored in this link/node
struct link* next; // Reference to the next link/node
} Link;
typedef struct list {
Link* head;
Link* tail;
Link* curr;
int cnt; // list size
} List;
typedef struct {
int m; // size of the hash table
int cnt; // number of elements in the dictionary
List* H; // hash table as an array of lists
// hash function
} Dictionary;
int h(string K);
Link* create_link(Link* nextval);
List* create_list();
Dictionary create_dict(int size, ); // Não sei botar o segundo parâmetro
int main(void) {
return 0;
}
int h(string K) {
int intLength = str.size(K)/4;
int sum = 0;
}
List* create_list() {
List* l = (List *) new int;
l->curr = l->tail = l->head = create_link(NULL); // header node
l->cnt = 0;
return l;
}
Link* create_link(Link* nextval) {
Link* n = (Link *) new int;
n->next = nextval;
return n;
}
Dictionary* create_dict(int size, ) {
Dictionary* d;
d->m = new List[size]; // ??
for(int i = 0; i <= size-1; i++) {
// a list of Entry, which combines Key and E
d->H[i] = create_list();
}
d->m = h;
return d;
}