📄 tr_ht_set_0.cc
字号:
// file: tr_ht_set_0.cc//// isip include files//#include "train_hash_table.h"#include "train_hash_table_constants.h" // method: set_size_cc//// arguments:// int_4 size : (input) size of hash table//// return: a logical_1 indicating success//// this method sets the size of the hash table//logical_1 Train_Hash_table::set_size_cc(int_4 size_a) { // dummy variables // Train_Hash_cell* cell = (Train_Hash_cell*)NULL; Train_Hash_cell* next = (Train_Hash_cell*)NULL; // free memory in the hash table lists // if (cells_d != (Train_Hash_cell**)NULL) { for (int_4 k = 0; k < size_d; k++) { cell = cells_d[k]; while (cell != (Train_Hash_cell*)NULL) { next = cell->get_next_cc(); delete cell; cell = next; } } delete [] cells_d; cells_d = (Train_Hash_cell**)NULL; } // set size of hash table // size_d = size_a; // reallocate the cells // if (size_d > 0) { cells_d = new Train_Hash_cell*[size_d]; for (int_4 i = 0; i < size_d; i++) { cells_d[i] = (Train_Hash_cell*)NULL; } } // exit gracefully // return ISIP_TRUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -