Share Pastebin
Guest
Public paste!

Derek

By: a guest | Feb 9th, 2010 | Syntax: C++ | Size: 0.31 KB | Hits: 12 | Expires: Never
Copy text to clipboard
  1. template<class T>
  2. void SAList<T>::insert(const T& data)
  3. {
  4.     Node<T> *add;
  5.     Node<T> *temp;
  6.  
  7.     add=new Node<T>(data);
  8.  
  9.     if(head==NULL)
  10.     {
  11.         head = add;
  12.     }
  13.     else
  14.     {
  15.         temp = head;
  16.         head = add;
  17.         head->next_ = temp;
  18.         temp->prev_ = head;
  19.     }
  20. }