/* Tabela de HASH com CHAINING */ #define HASHSIZE 31 typedef char* KeyType; typedef char* InfoType; typedef struct entry { KeyType key; InfoType info; struct entry *next; } Entry; typedef Entry* HashTable[HASHSIZE]; // função de hash int Hash(KeyType key); // inicializa a tabela de hash void InitializeTable(HashTable table); // limpa a tabela de hash // (obs.: liberta memória referente às chaves/informeção) void ClearTable(HashTable table); // insere uma nova associação entre uma chave "key" e a informação "info" // (obs.: duplica chave/informação, alocando espaço respectivo) void InsertTable(HashTable table, KeyType key, InfoType info); // apaga o elemento com chave "key" da tabela // (obs.: liberta memória referente à chave/informação) void DeleteTable(HashTable table, KeyType key); // procura na tabela o elemento de chave k, e retorna o apontador // para a informação (ou NULL caso k não exista) char* RetriveTable(HashTable table, KeyType key);