📄 ohtbl.h
字号:
/*****************************************************************************
* *
* ------------------------------- ohtbl.h -------------------------------- *
* *
*****************************************************************************/
#ifndef OHTBL_H
#define OHTBL_H
#include <stdlib.h>
/*****************************************************************************
* *
* Define a structure for open-addressed hash tables. *
* *
*****************************************************************************/
typedef struct OHTbl_ {
int positions;
void *vacated;
int (*h1)(const void *key);
int (*h2)(const void *key);
int (*match)(const void *key1, const void *key2);
void (*destroy)(void *data);
int size;
void **table;
} OHTbl;
/*****************************************************************************
* *
* --------------------------- Public Interface --------------------------- *
* *
*****************************************************************************/
int ohtbl_init(OHTbl *htbl, int positions, int (*h1)(const void *key), int
(*h2)(const void *key), int (*match)(const void *key1, const void *key2),
void (*destroy)(void *data));
void ohtbl_destroy(OHTbl *htbl);
int ohtbl_insert(OHTbl *htbl, const void *data);
int ohtbl_remove(OHTbl *htbl, void **data);
int ohtbl_lookup(const OHTbl *htbl, void **data);
#define ohtbl_size(htbl) ((htbl)->size)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -