Česky
Kamil Dudka

Tiny programs (C, C++, C#, ...)

File detail

Name:Downloadhtable.h [Download]
Location: tiny > IJC > du2
Size:999 B
Last modification:2007-08-29 17:44

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 *);