Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T>
- void CHashTable<T>::grow()
- {
- Size = 0;
- vector<T> newtable(table.size() * 2, "0");
- for (int i = 0; i < table.size(); i++)
- {
- if (table[i] != "0" && table[i] != "DEL")
- {
- int fHash = Hash1(table[i], newtable.size());
- int sHash = Hash2(table[i], newtable.size());
- while (newtable[fHash] != "0")
- {
- fHash = (fHash + sHash) % newtable.size();
- }
- newtable[fHash] = table[i];
- Size++;
- }
- }
- table = newtable;
- for (int i = 0; table.size(); i++)
- {
- cout << " " << table[i] << " ";
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement