hashfn.cpp
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C++ 代码 · 共 14 行
CPP
14 行
int hash(const Key &target)
/*
Post: target has been hashed, returning a value between 0 and hash_size -1.
Uses: Methods for the class Key.
*/
{
int value = 0;
for (int position = 0; position < 8; position++)
value = 4 * value + target.key_letter(position);
value %= hash_size;
if (value < 0) value += hash_size;
return value;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?