-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtable.h
35 lines (25 loc) · 909 Bytes
/
hashtable.h
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
typedef struct hashtable *HashTable;
#include <stdlib.h>
#include "pointerlist.h"
#include "task.h"
/* The item's value to be hashed */
#define hashKey(A) getId(A)
struct hashtable {
int M;
PointerList *pointerLists;
};
/* Allocates and initializes values for a new hashtable, returns
its pointer. */
HashTable initHashTable(int M);
/* Frees a single PointerLink in the hashtable. */
void freeLinkHashTable(HashTable hTable, PointerLink pointerLink);
/* Frees all PointerLinks in the list. */
void freeHashTableLinks(HashTable hTable);
/* Adds a new PointerLink to the hashtable. Receives itemLink
to hash the correct position in the hashtable. */
void addLinkToHash(HashTable hashId, ItemLink itemLink);
/* Returns the PointerLink with the correspondant searchValue. */
PointerLink findLinkInHash(HashTable hTable, unsigned long searchValue);
#endif