⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hashfn.cpp

📁 数据结构与程序设计教材源码 数据结构与程序设计教材源码
💻 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 + -