Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- void init(int size);
- int sling(char[] name, int size); // hashing function
- void slash(int size); // rehashing function
- int slide(int hash); // nextOpen
- int scatter(char chunk); // converts lowercase ascii char to int in range [0, 25]
- void show();
- int main(){
- char name[] = "aaa";
- char nam[] = "bbb";
- char na[] = "ccc";
- char n[] = "cab";
- sling(name, 200);
- sling(nam, 200);
- sling(na, 200);
- sling(n, 200);
- }
- int sling(char[] name, int size) {
- smothered = scatter(name[0]) * 676;
- covered = scatter(name[1]) * 26;
- slung = smothered + covered + scatter(name[2]);
- grease = 200/(size/100);
- return slung/grease;
- }
- int scatter(char chunk) {
- return chunk - 'a';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement