In C or Python, Write a universal hashing function for a string, taking as arguments a string and the capacity of the hashtable. — int hash(const char* key, const int m) { int hash = 0; for (int i = 0; i < key[i] != '\0'; ++i) { hash = hash * 31 + key[i]; } return abs(hash % m); }
G
1.2K
Google Interview
This flashcard deck made by jwasham contains knowledge about google interview. For more details, please follow https://github.com/jwasham/google-interview-university