mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-25 06:49:36 +03:00
Add files via upload
This commit is contained in:
parent
c26124199f
commit
1f82f4e2a2
@ -43,12 +43,6 @@ int get_hash(char s[])
|
||||
hash_code = s[counter] + (hash_code << 6) + (hash_code << 16) - hash_code;
|
||||
}
|
||||
|
||||
/*
|
||||
make sure hash_code is always positive.
|
||||
because we want uses it as index
|
||||
*/
|
||||
hash_code = (hash_code < 0) ? hash_code * -1 : hash_code;
|
||||
|
||||
/* % modulo is for fitting the index in array. */
|
||||
return hash_code % MAXELEMENTS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user