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

📄 testhash.c

📁 清华大学出版的数据结构(C语言版)中书中所提到的所有C源程序的实现。
💻 C
字号:
#define SepChain    /* Define the appropriate hash algorithm */#ifdef SepChain    #include "hashsep.h"#endif#ifdef QuadProb    #include "hashquad.h"#endif#include <stdio.h>#define NumItems 400main( ){    HashTable H;    Position P;    int i;    int j = 0;    int CurrentSize;    H = InitializeTable( CurrentSize = 13 );    for( i = 0; i < NumItems; i++, j += 71 )    {    #ifdef QuadProb        if( i > CurrentSize / 2 )        {            H = Rehash( H );            printf( "Rehashing...\n" );            CurrentSize *= 2;        }    #endif        Insert( j, H );    }    for( i = 0, j = 0; i < NumItems; i++, j += 71 )    #ifdef SepChain        if( ( P = Find( j, H ) ) == NULL || Retrieve( P ) != j )    #endif    #ifdef QuadProb        if( Retrieve( ( P = Find( j, H ) ), H ) != j )    #endif            printf( "Error at %d\n", j );    printf( "End of program.\n" );    return 0;}

⌨️ 快捷键说明

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