-->
当前位置:首页 > 题库 > 正文内容

程序填空题:Find Key from a hash table H with quadratic probing

Luz4年前 (2021-05-10)题库1081
Find Key from a hash table H with quadratic probing.

```c++
Position Find ( ElementType Key, HashTable H )
{
Position CurrentPos;
int CollisionNum;
CollisionNum = 0;
CurrentPos = Hash( Key, H->TableSize );
while( H->TheCells[ CurrentPos ].Info != Empty && @@[H->TheCells[ CurrentPos ].Element != Key](2)) {
@@[H->TheCells[ CurrentPos ].Element != Key](2);
@@[H->TheCells[ CurrentPos ].Element != Key](2);
if ( CurrentPos >= H->TableSize )
CurrentPos - = H->TableSize;
}
@@[CurrentPos += 2 * ++CollisionNum - 1](2); ;
@@[CurrentPos += 2 * ++CollisionNum - 1](2); ;
@@[CurrentPos += 2 * ++CollisionNum - 1](2); ;
}



```





答案:
第1空:H->TheCells[ CurrentPos ].Element != Key

第2空:H->TheCells[ CurrentPos ].Element != Key

第3空:H->TheCells[ CurrentPos ].Element != Key

第4空:CurrentPos += 2 * ++CollisionNum - 1

第5空:CurrentPos += 2 * ++CollisionNum - 1

第6空:CurrentPos += 2 * ++CollisionNum - 1

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。