-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashmap.h
More file actions
53 lines (42 loc) · 890 Bytes
/
Copy pathhashmap.h
File metadata and controls
53 lines (42 loc) · 890 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
43
44
45
46
47
48
49
50
51
52
53
/*
* HashMap.h
*
* Created on: Jun 29, 2019
* Author: AMUTHAN
*/
#ifndef HASHMAP_H_
#define HASHMAP_H_
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define HASHTABLE_SIZE 65536
typedef enum key_type{
INTEGER,
STRING,
FRACTIONAL_NUMBER
}
KEY_TYPE;
#define INT_FORMAT "%d"
#define LL_FORMAT "%lld"
typedef struct hash_node{
char* userkey;
int index;
void* data;
struct hash_node* chain;
}
HashNode;
typedef struct hash_map{
HashNode *hashtable;
char booleanTable[HASHTABLE_SIZE];
int capacity;
KEY_TYPE keyType;
}
HashMap;
int hash_getkey(char* userkey);
HashMap* hashmap();
HashNode* init_hashnode(char* userkey,void* data);
void free_hashmap(HashMap* map);
//API Functions
void hashmap_put(HashMap* map,void* keyData,void* data);
void* hashmap_get(HashMap* map,void* keyData);
#endif /* HASHMAP_H_ */