Advertisement
Guest User

Untitled

a guest
Nov 13th, 2015
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1.  
  2. #ifndef HASHTABLEOPEN_H
  3. #define HASHTABLEOPEN_H
  4.  
  5. #include <string>
  6.  
  7. // HashTable
  8. // =========
  9. std::string HashtableOpen[];
  10.  
  11. std::string* HashTableOpen_construct(int size);
  12. bool HashTableOpen_insert(std::string *HashtableOpen, std::string item, int size);
  13. int findslot(std::string *HashtableOpen, int size, int h);
  14. int overrun(std::string *HashtableOpen, int hO);
  15. void HashTableOpen_destroy(std::string *HashtableOpen, int size);
  16. int hashtable_lookup(std::string HashtableOpen, int size, std::string item);
  17.  
  18. int tinyhash(std::string item);
  19.  
  20. /*
  21.  
  22. 0: _
  23. 1: _
  24. 2: _
  25. 3: _
  26. 4: _
  27. 5: _
  28. 6: _
  29.  
  30. First we insert "fizzle" (suppose it hashes to 4)
  31.  
  32. 0: _
  33. 1: _
  34. 2: _
  35. 3: _
  36. 4: "fizzle"
  37. 5: _
  38. 6: _
  39.  
  40. Next we insert "sticks" (suppose it hashes to 2)
  41.  
  42. 0: _
  43. 1: _
  44. 2: "sticks"
  45. 3: _
  46. 4: "fizzle"
  47. 5: _
  48. 6: _
  49.  
  50. Next we insert "hello" (suppose it hashes to 2 also... collision!)
  51.  
  52. 0: _
  53. 1: _
  54. 2: "sticks"
  55. 3: "hello"   [Was supposed to go into bucket #2, but had to be bumped]
  56. 4: "fizzle"
  57. 5: _
  58. 6: _
  59.  
  60. Next we insert "world" (suppose it hashes to 2 also... another collision!)
  61.  
  62. 0: _
  63. 1: _
  64. 2: "sticks"
  65. 3: "hello"
  66. 4: "fizzle"
  67. 5: "world"  [Was supposed to go into bucket #2, but had to be bumped.. a lot]
  68. 6: _
  69.  
  70. */
  71.  
  72. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement