📄 ckhash.h
字号:
/*** Copyright (C) 2006 Thai Computational Linguistics Laboratory (TCL)** National Institute of Information and Communications Technology (NICT)** Canasai Kruengkrai <canasai xx gmail yy com, where xx=at and yy=dot>**** This file is part of the `libs' library.**** This library is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#define CKH_INFINITY -999999999typedef int boolean; typedef struct { // hash table cell type char *key; int value;} Cell;typedef struct { // dictionary type int size; // current size int shift; // value used for hash function int table_size; // size of hash tables int min_size, mean_size; // rehash trigger sizes int max_chain; // max. iterations in insert Cell *T1; // point to hash table 1 Cell *T2; // point to hash table 2 int function_size; // size of hash function int *a1; // hash function 1 int *a2; // hash function 2} Dict;Dict *ckh_alloc_dict ( int table_size );Dict *ckh_construct_dict ( int min_size );boolean ckh_insert ( Dict *D, char *key, int value );boolean ckh_lookup ( Dict *D, char *key );boolean ckh_delete ( Dict *D, char *key );int ckh_get ( Dict *D, char *key );boolean ckh_increase_value ( Dict *D, char *key );boolean ckh_decrease_value ( Dict *D, char *key );Dict *ckh_destruct_dict ( Dict *D );void ckh_print ( Dict *D );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -