-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashTable.h
45 lines (28 loc) · 884 Bytes
/
HashTable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
ADT HashTable
SPECIFICA SINTATTICA
Tipi usati: bool, Item, Key.
Operatori:
newHashTable() ➤ HashTable
insertHash(HashTable, Key, Item) ➤ bool
searchHash(HashTable, Key) ➤ Item
deleteHash(HashTable, Key) ➤ bool
SPECIFICA SEMANTICA
newHashTable() ➔ t
Post: t = {}
insertHash(t, k, e) ➔ t'
Post: t = {a1, a2, ..., an} AND t' = {a1, a2, ..., e, ..., an}
searchHash(t, k) ➔ e
Pre: t = {a1, a2, .., an} AND n > 0
Post: e = ai AND 1 <= i <= n se ai->key = k
deleteHash(t, k) ➔ t'
Pre: t = {a1, a2, .., an} AND n > 0 AND ai->key = k con 1<= i <= n
Post: t' = {a1, a2, ..., ai-1, ai+1, ..., an}
*/
#include "Item.h"
typedef struct hash* HashTable;
HashTable newHashTable (int);
int insertHash (HashTable, char*, Item);
Item searchHash (HashTable, char*);
int deleteHash (HashTable, char*);
void destroyHash (HashTable);