ckhash.h

来自「CKHash is an implementation of Cuckoo Ha」· C头文件 代码 · 共 66 行

H
66
字号
/*** Copyright (C) 2005 Thai Computational Linguistics Laboratory (TCL)** National Institute of Information and Communications Technology (NICT)** Written by Canasai Kruengkrai <canasaiREMOVETHIS@gmail.com>**** This file is part of the `CKHash' 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.*/#ifndef __CKHash_H#define __CKHash_Htypedef struct {             /* hash table cell type */    char *key;               /* hash key */    int value;               /* hash 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 );int ckh_insert( Dict *D, char *key, int value );int ckh_lookup( Dict *D, char *key );int ckh_delete( Dict *D, char *key );int ckh_get( Dict *D, char *key );int ckh_increase_value( Dict *D, char *key );int ckh_decrease_value( Dict *D, char *key );Dict *ckh_destruct_dict( Dict *D );void ckh_print( Dict *D );#endif /* __CKHash_H */

⌨️ 快捷键说明

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