习题5.10 线性探测法的查找函数 (20分)
代码:
Position Find( HashTable H, ElementType Key )
{
int index = Hash(Key, H->TableSize), count = 0;
while (count != H->TableSize) {
if (H->Cells[index].Info == Empty || H->Cells[index].Info == Deleted || H->Cells[index].Data == Key) return index;
index = (index + 1) % H->TableSize;
count++;
}
return ERROR;
}