⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hashfunc.c

📁 weis的数据结构的实现方法很经典很强大
💻 C
字号:
/* Here are some of the hash functions *//* for strings that are in the text */typedef unsigned int Index;/* START: fig5_3.txt */        Index        Hash1( const char *Key, int TableSize )        {            unsigned int HashVal = 0;/* 1*/      while( *Key != '\0' )/* 2*/          HashVal += *Key++;/* 3*/      return HashVal % TableSize;        }/* END *//* START: fig5_4.txt */        Index        Hash2( const char *Key, int TableSize )        {            return ( Key[ 0 ] + 27 * Key[ 1 ] + 729 * Key[ 2 ] )                        % TableSize;        }/* END *//* START: fig5_5.txt */        Index        Hash3( const char *Key, int TableSize )        {            unsigned int HashVal = 0;/* 1*/      while( *Key != '\0' )/* 2*/          HashVal = ( HashVal << 5 ) + *Key++;/* 3*/      return HashVal % TableSize;        }/* END */

⌨️ 快捷键说明

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