Advertisement
Guest User

Hash

a guest
Apr 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. void HashTable::hash(double value)
  2. {
  3.     unsigned int hashValue = hashFunc(value);
  4.  
  5.     if (this->hashList[hashValue] == nullptr)
  6.         this->hashList[hashValue] = new HashNode(value, nullptr, nullptr);
  7.     else
  8.     {
  9.         while (this->hashList[hashValue]->Next != nullptr)
  10.             this->hashList[hashValue] = this->hashList[hashValue]->Next;
  11.  
  12.         HashNode *newNode = new HashNode(value, nullptr, nullptr);
  13.  
  14.         this->hashList[hashValue]->Next = newNode;
  15.         newNode->Prev = this->hashList[hashValue]->Prev;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement