-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhash.h
More file actions
35 lines (26 loc) · 742 Bytes
/
hash.h
File metadata and controls
35 lines (26 loc) · 742 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 __HASH_H_
#define __HASH_H_
#include "headers.h"
// maintain a hash table where values are linked list
// first calc hash of string % huge prime num (1e9 + 7)
// coordinate compress it
// make a hash table out of this compressed values.
typedef struct node{
char* a;
int n;
int index;
pthread_rwlock_t lock;
struct node* nxt;
}node;
typedef struct compress{
char* a;
long long int hashval;
}compress;
node** CreateHT(int itablesize);
void Insert(char* x, int n, int pos, node** hashtable, int ss);
void Delete(char* x, int pos, node** hashtable);
long long int hash(char* x, int* primes, int n);
bool isPrime(int x);
int findnextprime(int x);
int get(node** hashtable, char* cmp, int pos);
#endif