Skip to content

Commit

Permalink
Switched HashMap implementation from separate chaining to open addres…
Browse files Browse the repository at this point in the history
…sing + updated tests accordingly
  • Loading branch information
loumadev committed Nov 4, 2023
1 parent 6dc0ee9 commit 47344ed
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 165 deletions.
14 changes: 7 additions & 7 deletions include/internal/HashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
#define HASHMAP_LOAD_FACTOR 0.75
#define HASHMAP_RESIZE_FACTOR 2

typedef struct HashMapEntry {
String *key;
void *value;
struct HashMapEntry *next;
} HashMapEntry;

typedef struct HashMap {
size_t size;
size_t capacity;
struct HashMapEntry **entries;
struct HashMapEntry *entries;
} HashMap;

typedef struct HashMapEntry {
String *key;
void *value;
int deleted; // Flag to mark deleted entries
} HashMapEntry;

/**
* Initializes a new HashMap instance.
*
Expand Down
Loading

0 comments on commit 47344ed

Please sign in to comment.