-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashmap.h
30 lines (26 loc) · 812 Bytes
/
hashmap.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
#ifndef _hashmap
#define _hashmap
#define DEFAULT_SIZE 10
#define LOAD_FACTOR 0.75
typedef struct hashMapElement{
char *key;
int value;
}hashMapElement;
typedef struct hashmap{
hashMapElement **elementArray;
int *array_position;
int number_of_elements;
int capaciteit;
double current_loadfactor;
int (*fp_addElement)(char *,int,struct hashmap *); //0 for succes, -1 for fail
void*(*fp_getElement)(char *,struct hashmap *);
int (*fp_removeElement)(char *,struct hashmap*); //0 for success, -1 for fail
void (*fp_clean_up)(); //vrijmaken van geheugen
void (*fp_init_hashmap)(struct hashmap *); //init van de hashmap
}hashmap;
int addElement(char *,int,hashmap*);
void* getElement(char*,hashmap*);
int removeElement(char*,hashmap*);
void clean_up();
void init_hashmap(hashmap*);
#endif