📄 tr_ht_hash_5.cc
字号:
// file: tr_ht_hash_5.cc//// isip include files//#include "train_hash_table.h"#include "train_hash_table_constants.h" // method: hash_lookup_cc//// arguments:// int_4* vec: (input) the vector to be looked up in the hash table// int_4 size: (input) the length of the vector//// return: a Train_Hash_cell pointer to the cell containing this entry//// this method looks up an entry for the given string in the hash table// using the standard hash function in Kernighan & Ritchie (pp 145)//Train_Hash_cell* Train_Hash_table::hash_lookup_cc(int_4* vec_a, int_4 size_a) { // index variables // int_4* key_vec = (int_4*)NULL; int_4 key_size = 0; Train_Hash_cell* cell = (Train_Hash_cell*)NULL; // find the cell containing this string // int_4 index = hash_vector_cc(vec_a, size_a); for (cell = cells_d[index]; cell != (Train_Hash_cell*)NULL; cell = cell->get_next_cc()) { // get the key string in this cell // cell->get_key_cc(key_vec, key_size); if ((key_size == size_a) && (memcmp(key_vec, vec_a, size_a * sizeof(int_4)) == 0)) { break; } } // exit gracefully // return cell;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -