提交 ced73fc0 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 00dfbdda
#ifndef SEARCHHASH_H_ #ifndef SEARCHHASH_H_
#define SEARCHHASH_H_ #define SEARCHHASH_H_
// //
// Include the C standard library header file here // Include the C standard library header file here
// //
#include <stdio.h> #include <stdio.h>
// //
// Other header files are included here // Other header files are included here
// //
// //
// Define the data structure here // Define the data structure here
// //
#define HASH_LEN 20 // The length of the hash table #define HASH_LEN 20 // The length of the hash table
// Hash table // Hash table
typedef struct hterm{ typedef struct hterm
{
int key; // keyword int key; // keyword
int si; // The number of rehashes int si; // The number of rehashes
}HASH; }HASH;
...@@ -34,17 +29,12 @@ typedef struct hterm{ ...@@ -34,17 +29,12 @@ typedef struct hterm{
// Declare the function here // Declare the function here
// //
void Hash(int* KeyArray, int length); // The hash function void Hash(int* KeyArray, int length); // The hash function
// //
// Declare global variables here // Declare global variables here
// //
extern HASH HashList[HASH_LEN]; extern HASH HashList[HASH_LEN];
#endif /* SEARCHHASH_H_ */ #endif /* SEARCHHASH_H_ */
...@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) ...@@ -18,7 +18,7 @@ int main(int argc, char* argv[])
Hash(KeyArray, length); Hash(KeyArray, length);
printf("\nSubscript\tRehashesCount\tKeyword\t\n"); printf("\nSubscript\tRehashesCount\tKeyword\t\n");
for(i=0; i<HASH_LEN; i++) for (i=0; i<HASH_LEN; i++)
{ {
printf("%d", i); printf("%d", i);
printf("\t\t\t%d", HashList[i].si); printf("\t\t\t%d", HashList[i].si);
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论