hash.cpp

来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C++ 代码 · 共 23 行

CPP
23
字号
 
Error_code Hash_table::insert(Cell *new_entry)
{
   int probe, location;
   Cell *found;
   probe = hash(new_entry->row, new_entry->col);
   if (sequential_search(table[probe], new_entry->row, new_entry->col,
                                       location, found) == not_present)
      return (table[probe].insert(0, new_entry));
   else
      return (duplicate_error);
}
 
bool Hash_table::retrieve(int row, int col) const
{
   int probe, location;
   Cell *found;
   probe = hash(row, col);
   if (sequential_search(table[probe], row, col, location, found) ==
                         success) return true;
   else return false;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?