Implemention of HashTable(Part I)
来源:互联网 发布:淘宝卫浴店铺装修 编辑:程序博客网 时间:2024/04/27 19:05
fellowing is some hash function:
/**//*
Name: hash functions
Copyright: All Right Reserved @ lizuding@gmail.com
Author: lizuding
Date: 21-01-08 21:46
Description: implemention of hash function
*/
const unsigned long M=100;
/**//*
* ELFHash 函数,由于UNIX的“可执行链接格式,ELF”
* const char *key 关键字
*/
int ELFHash(const char *key) ...{
unsigned long h = 0;
while ( *key ) ...{
h = (h << 4) + *key ++;
unsigned long g = h & 0XF0000000L;
if ( g )
h ^= g >> 24;
h &= -g;
}
return h % M;
}
template<class T>
int remainder_hash(int key) ...{
}
/**//*
* 移位折叠法
*/
template<class T>
int shift_pucker_hash(int key) ...{
unsigned long tmp = 0;
unsigned long filter = 0X00000033L;
for (int i = 0; i < 16; i += 4) ...{
filter <<= i;
tmp += key & filter;
}
return tmp % M;
}
template<class T>
int divide_pucker_hash(int key) ...{}
template<class T>
int square_media_hash(int key) ...{
unsigned long hash = 0;
hash = key * key;
hash &= 0X0001FF00L;
return hash % 100;
}
Name: hash functions
Copyright: All Right Reserved @ lizuding@gmail.com
Author: lizuding
Date: 21-01-08 21:46
Description: implemention of hash function
*/
const unsigned long M=100;
/**//*
* ELFHash 函数,由于UNIX的“可执行链接格式,ELF”
* const char *key 关键字
*/
int ELFHash(const char *key) ...{
unsigned long h = 0;
while ( *key ) ...{
h = (h << 4) + *key ++;
unsigned long g = h & 0XF0000000L;
if ( g )
h ^= g >> 24;
h &= -g;
}
return h % M;
}
template<class T>
int remainder_hash(int key) ...{
}
/**//*
* 移位折叠法
*/
template<class T>
int shift_pucker_hash(int key) ...{
unsigned long tmp = 0;
unsigned long filter = 0X00000033L;
for (int i = 0; i < 16; i += 4) ...{
filter <<= i;
tmp += key & filter;
}
return tmp % M;
}
template<class T>
int divide_pucker_hash(int key) ...{}
template<class T>
int square_media_hash(int key) ...{
unsigned long hash = 0;
hash = key * key;
hash &= 0X0001FF00L;
return hash % 100;
}
- Implemention of HashTable(Part I)
- Implemention of Partition Function
- New Features of WCF 4.0: Part I
- Powers of Ten – Part I
- MyLineNumberReader, a implemention of java.io.LineNumberReader
- Art of Writing TestBenches (of Verilog HDL) Part - I
- Part I
- Free Philosophy: Part I The Beauty of Doubt
- 2012 FRM Part I Fundations of Ris Management
- Gate Level Modeling Part-I (of Verilog HDL)
- User Defined Primitives Part-I (of Verilog HDL)
- The Study of Tomcat Source Code -- Part I
- Lowest Common Ancestor of a Binary Tree Part I
- Part I. Overview of Spring Framework
- Lowest Common Ancestor of a Binary Tree Part I
- C++ and The Perils of Double-Checked Locking: Part I
- JSR75 - part I FCAPI
- Programming pearls part I
- 44b0引导注释
- 44B0下ucos-ii的移植
- java RTTI应用
- S3C44B0存储器的BANK设计和控制
- 如何带着“金子”跳槽
- Implemention of HashTable(Part I)
- S3C44B0X寄存器描述
- 在这里寻找信心
- S3c44b0x RTC程序
- left join/right join/inner join操作演示
- 四种方法实现VC枚举系统当前进程
- 2007年度最佳造句奖
- 44b0x RTC调试经验
- 看过的一篇,没湿,有点感觉。。。