Last active
November 17, 2020 08:10
-
-
Save ochilab/e1fb38099e3fc52eef36cb5193d19262 to your computer and use it in GitHub Desktop.
ハッシュ法におけるチェイン法の実装
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node *SearchChainNode (Hash *h, Data x){ | |
int key = hash(x.no);/* 探索するデータのハッシュ値 */ | |
Node *p = h->table[key]; /* 着目ノード */ | |
while (p != NULL) { | |
if (p->data.no == x.no) /* 探索成功 */ | |
return (p); | |
p = p->next; /* 後続ノードに着目 */ | |
} | |
return (NULL); /* 探索失敗 */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment