#include #include #include #define STR_SIZE 21 #define MAX_NO_ASSOC 10 typedef struct { char att[STR_SIZE]; int nassoc; int assoc[MAX_NO_ASSOC]; } htnode; typedef struct { int S; htnode *A, *B; } hashtable; typedef struct { char x[STR_SIZE]; char y[STR_SIZE]; } pair; int H ( char *z, int S ) { int i, l, sum; l = strlen(z); sum = 0; for (i=0; i= 0) && (j >= 0)) { for (ai=0; ai= 0) { for (j=0; j= 0) return j; while (1) { if (!strcmp(C[i].att,z)) return i; if ((!strcmp(C[i].att,"EMPTY")) || (!strcmp(C[i].att,"DELETED"))) { strcpy(C[i].att,z); C[i].nassoc = 0; return i; } if (++i == S) i = 0; } } hashtable insertpair ( hashtable T, pair data ) { int hi, hj, i, j, k; hi = H(data.x,T.S); hj = H(data.y,T.S); i = findinsidx(T.A,data.x,T.S,hi); j = findinsidx(T.B,data.y,T.S,hj); for (k=0; k