Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. Node * copy(Node * n)
  2. {
  3.     if (n == nullptr)
  4.     return nullptr;
  5.     else {
  6.     Node * p = new Node;
  7.     p -> info = n -> info;
  8.     p -> value = n -> value;
  9.     p -> next = new Node(copy(n->next));
  10.     }
  11. }
  12.  
  13. void HashMap::add(string key1, string value1)
  14. {
  15.     int index=3;
  16.     for (Node * p=database[index]; p != nullptr; p=p->next)
  17.     {
  18.     if (p->next == nullptr) {
  19.         p->next=new Node;
  20.         p->next->key = key1;
  21.         p->next->value = value1;
  22.         p->next->next = nullptr;
  23.         break;
  24.     }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement