C语言 简单链式哈希
来源:互联网 发布:淘宝联盟一直不提现 编辑:程序博客网 时间:2024/05/20 18:40
#include <stdio.h>#include <stdlib.h>#include "doulist.h"typedef struct hash{Pnode buff[10];}Hash, *pHash;Hash *createHash(){pHash p = (pHash)malloc(sizeof(Hash));if (NULL == p){return NULL;}for (int i = 0; i < 10; i++)//-1代表空{p->buff[i] =NULL;}return p;}void destroyHash(Hash *p){if (NULL == p){return -1;}for (int i = 0; i < 10; i++)//-1代表空{/*if (NULL != p->buff[i]){free(p->buff[i]);}*/douListDestroy(&(p->buff[i]));}free(p);}int hashFunc(int key){if (key < 0){return -1;}key = key % 10;return key;//---------------------------------}int insertHash(Hash *p, int data){if (NULL == p){return -1;}int index = hashFunc(data);//内存 与 数据的关系if (-1 == index){return NULL;}int ret=douListInsertDataBySort(&(p->buff[index]), data);if (0 == ret){return 0;}return -1;}Pnode findHash(Hash *p, int data){if (NULL == p){return NULL;}if (data < 0){return NULL;}int index = hashFunc(data);if (-1 == index){return NULL;} Pnode p=douListFindNode(p->buff[index], data); return p;}void main(){}
0 0
- C语言 简单链式哈希
- 用C语言实现简单链式队列结构
- 链式表- C语言
- C语言 链式栈
- C语言 链式队列
- c语言链式栈
- C语言实现链式队列
- C语言实现链式栈
- C语言实现链式队列
- 数据结构--链式栈(C语言)
- c语言链式存储实现
- c语言实现链式队列
- c语言中的链式访问
- 链式栈 C语言数据结构
- 数据结构 - 队列简介 及 1个简单的c语言链式队列代码实现
- 用c语言实现的链式栈
- 数据结构实现链式队列(C语言)
- 数据结构-链式栈-C语言实现
- MAKEFILE基本写法.
- 5分钟完全理解android handler
- CNN for image retrieval
- TCP的窗口滑动机制与拥塞控制
- SVN提交报错:Unable to connect to a repository at URL
- C语言 简单链式哈希
- 第六章 使用C#开发数据库应用系统 上机练习1-4
- 长连接和短连接
- webview加载本地html注意事项
- Android串口例子
- android 四大应用主键之 --- ContentProvider (内容提供者)
- Oracle 循环向某张表中插入数据
- Redis单机版搭建
- 形态学操作