Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef HASHTABLEOPEN_H
- #define HASHTABLEOPEN_H
- #include <string>
- // HashTable
- // =========
- std::string HashtableOpen[];
- std::string* HashTableOpen_construct(int size);
- bool HashTableOpen_insert(std::string *HashtableOpen, std::string item, int size);
- int findslot(std::string *HashtableOpen, int size, int h);
- int overrun(std::string *HashtableOpen, int hO);
- void HashTableOpen_destroy(std::string *HashtableOpen, int size);
- int hashtable_lookup(std::string HashtableOpen, int size, std::string item);
- int tinyhash(std::string item);
- /*
- 0: _
- 1: _
- 2: _
- 3: _
- 4: _
- 5: _
- 6: _
- First we insert "fizzle" (suppose it hashes to 4)
- 0: _
- 1: _
- 2: _
- 3: _
- 4: "fizzle"
- 5: _
- 6: _
- Next we insert "sticks" (suppose it hashes to 2)
- 0: _
- 1: _
- 2: "sticks"
- 3: _
- 4: "fizzle"
- 5: _
- 6: _
- Next we insert "hello" (suppose it hashes to 2 also... collision!)
- 0: _
- 1: _
- 2: "sticks"
- 3: "hello" [Was supposed to go into bucket #2, but had to be bumped]
- 4: "fizzle"
- 5: _
- 6: _
- Next we insert "world" (suppose it hashes to 2 also... another collision!)
- 0: _
- 1: _
- 2: "sticks"
- 3: "hello"
- 4: "fizzle"
- 5: "world" [Was supposed to go into bucket #2, but had to be bumped.. a lot]
- 6: _
- */
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement