📄 hashfn.cpp
字号:
const int factor = 101;
int hash(int row, int col)
/*
Post: The function returns the hashed valued between
0 and hash_size - 1 that corresponds to the given
Cell parameter.
*/
{
int value;
value = row + factor * col;
value %= hash_size;
if (value < 0) return value + hash_size;
else return value;
}
Error_code sequential_search(const List<Cell *> &the_list, int row, int col,
int &location, Cell *&found)
{
int s = the_list.size();
for (location = 0; location < s; location++) {
the_list.retrieve(location, found);
if (found->row == row && found->col == col) return success;
}
return not_present;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -