Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C Compiler.
  4. Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10.  
  11. void init(int size);
  12. int sling(char[] name, int size); // hashing function
  13. void slash(int size); // rehashing function
  14. int slide(int hash); // nextOpen
  15. int scatter(char chunk); // converts lowercase ascii char to int in range [0, 25]
  16.  
  17. void show();
  18.  
  19. int main(){
  20. char name[] = "aaa";
  21. char nam[] = "bbb";
  22. char na[] = "ccc";
  23. char n[] = "cab";
  24. sling(name, 200);
  25. sling(nam, 200);
  26. sling(na, 200);
  27. sling(n, 200);
  28. }
  29.  
  30. int sling(char[] name, int size) {
  31. smothered = scatter(name[0]) * 676;
  32. covered = scatter(name[1]) * 26;
  33. slung = smothered + covered + scatter(name[2]);
  34. grease = 200/(size/100);
  35. return slung/grease;
  36. }
  37.  
  38. int scatter(char chunk) {
  39. return chunk - 'a';
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement