int locate(int s)
{
int h;
h=Hash(s);
while (use[h]&&pst[h]!=s)
{
h++;
if (h>=max) h-=max;
}
return h;
}
void insert(int s)
{
int posi=locate(s);
if (!use[posi])
{
use[posi]=1;
pst[posi]=s;
}
}
void delete(int s)
{
int posi=locate(s);
if (use[posi]&&psw[posi]==s)
use[posi]=0;
}
bool search(int s)
{
int posi=locate(s);
if (use[posi]&&psw[posi]==s)
return true;
else
return false;
}
ELFHash
unsigned int ELFHash(char *str)
{
unsigned int hash = 0,x = 0;
while (*str)
{
hash = (hash << 4) + (*str++);
if ((x = hash & 0xF0000000L) != 0)
{
hash ^= (x >> 24);
hash &= ~x;
}
}
return (hash & 0x7FFFFFFF);
}