Data Structures Lerax  v3.0-104-ge031
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
hash-table-gen.h
Go to the documentation of this file.
1
12
13#ifndef HASH_TABLE_GEN_H
14#define HASH_TABLE_GEN_H
15
16#include <stddef.h>
17#include <stdbool.h>
19#include "../list/single/list.h"
20
22
30
38
46
54void hash_table_gen_put(HashTableGen *ht, int key, void *data);
55
63
72void* hash_table_gen_get(HashTableGen *ht, int key, bool *exists);
73
81
88
96
103void hash_table_gen_free(HashTableGen *ht, void (*free_data)(void *));
104
105#endif /* HASH_TABLE_GEN_H */
void * hash_table_gen_get(HashTableGen *ht, int key, bool *exists)
Gets the value associated with a key.
List * hash_table_gen_keys(HashTableGen *ht)
Gets the keys of the hash table.
void hash_table_gen_put(HashTableGen *ht, int key, void *data)
Inserts a key-value pair into the hash table.
bool hash_table_gen_empty(HashTableGen *ht)
Checks if the hash table is empty.
HashTableGen * hash_table_gen_create(size_t n_buckets)
Creates a new generic hash table.
size_t hash_table_gen_size(HashTableGen *ht)
Gets the size of the hash table.
void hash_table_gen_remove(HashTableGen *ht, int key)
Removes a key-value pair from the hash table.
HashTableGen * hash_table_gen_copy(HashTableGen *ht)
Creates a copy of the hash table.
void hash_table_gen_print(HashTableGen *ht)
Prints the hash table.
void hash_table_gen_free(HashTableGen *ht, void(*free_data)(void *))
Frees the memory allocated for the hash table.
struct HashTableGen HashTableGen
Definition hash-table-gen.h:21
struct ListNode List
A singly linked list.
Definition list.h:36