|
|
해쉬 함수와 충돌 해소
|
|
[
좋은
해쉬 함수 ] Index
Hash (const char *Key, int
TableSize ) { unsigned
int HashVal = 0; /*1*/ while(
*Key != '\0' ) /*2*/ HashVal
= ( HashVal << 5 ) + *KEY++; /*3*/ return(
HashVal % TableSize ); }
※ 5 Bit Shift는 숫자 10개,
알파벳 20 여 개를 합하여 25 = 32를 곱하는
것이다.
|