Implemented a simple hash table using the FNV-1a hashing algorithm. Not drawing routines for it yet, just the bare data structure.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#ifndef HASTABLE_H
|
||||
#define HASTABLE_H
|
||||
|
||||
typedef struct {
|
||||
char* Key;
|
||||
char* Value;
|
||||
} BucketKeyPair;
|
||||
|
||||
typedef struct {
|
||||
unsigned int Size;
|
||||
unsigned int Capacity;
|
||||
BucketKeyPair** KeyPairs;
|
||||
} Bucket;
|
||||
|
||||
typedef struct {
|
||||
unsigned int Capacity;
|
||||
Bucket** Values;
|
||||
} HashTable;
|
||||
|
||||
HashTable* CreateHashTable(void);
|
||||
void AddItemToHashTable(char* key, char* item, HashTable* table);
|
||||
char* GetHashTableItem(char* key, HashTable* table);
|
||||
void PrintHashTable(HashTable* table);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user