Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashmap #15

Closed
adamhutchings opened this issue Jun 19, 2024 · 0 comments · Fixed by #50
Closed

Hashmap #15

adamhutchings opened this issue Jun 19, 2024 · 0 comments · Fixed by #50
Assignees
Labels
Data Structures Useful data structures to use elsewhere

Comments

@adamhutchings
Copy link
Contributor

We need some hash map utilities. Probably have the keys be const char *s and the values be void *. Here is a suggested API:
Creating and destroying:
int hm_init(Hashmap *hm, int num_buckets);
int hm_free(Hashmap *hm);
Looking up and setting values:
void* hm_lookup(Hashmap *hm, const char* key);
int hm_set(Hashmap *hm, const char *key, void *value);
Alter this as you see fit, as long as we can use const char* keys to access void* values and it mostly runs in O(1).

@adamhutchings adamhutchings added the Data Structures Useful data structures to use elsewhere label Jun 19, 2024
@NicoBliss NicoBliss self-assigned this Jun 22, 2024
@NicoBliss NicoBliss linked a pull request Jun 26, 2024 that will close this issue
@JakeRoggenbuck JakeRoggenbuck mentioned this issue Aug 4, 2024
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data Structures Useful data structures to use elsewhere
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants