Tiny programs (C, C++, C#, ...)
File detail
Source code
/*
* Soubor: htable.h - rozhrani modulu htable.c
* Kamil Dudka, FIT, DU2, priklad 2, 17.4.2005
*/
// Polozka seznamu hashovaci tabulky
struct htable_listitem {
char *uk; // Ukazatel na retezec
int n; // Inkrementacni promenna
struct htable_listitem *next; // Ukazatel na dalsi polozku seznamu
};
// Struktura obsahujici informace o hashovaci tabulce
typedef struct {
unsigned size;
struct htable_listitem **data;
} htable_t;
// Vytvoreni hashovaci tabulky velikosti size, inicializace
htable_t *htable_init (unsigned size);
// Smazani vsech polozek hashovaci tabulky
void htable_clear (htable_t *);
// Vytiskne obsah hashovaci tabulky - viz. zadani ulohy
void htable_print (htable_t *);
// Uvolni hashovaci tabulky (vcetne jejich polozek)
void htable_free (htable_t *);
// Vyhleda retezec pomoci hashovaci tabulky
// Pokud se retezec nepodari najit, vlozi se
// do seznamu nova polozka obsahujici zadany retezec
struct htable_listitem *htable_lookup (htable_t *, const char *);