Skip to main content
added 344 characters in body
Source Link
Medicine
  • 443
  • 5
  • 9
  • 14

here is LinkedList class I implemented using c++ templates. also I implemented reverse and sorting linked list by merge sort

template <class T>
void LinkedList<T>::reverseList()
{
  Node<T> *curr = head, *prev = head, *save = NULL;

  while (curr)
    {
      save = curr->next;
      curr->next = prev;
      prev = curr;
      curr = save;
    }

  head->next = NULL;
  head = prev;
}

https://code.google.com/p/medicine-cpp/source/browse/trunk/cpp/ds/LinkedList.cpp

here is LinkedList class I implemented using c++ templates. also I implemented reverse and sorting linked list by merge sort

https://code.google.com/p/medicine-cpp/source/browse/trunk/cpp/ds/LinkedList.cpp

here is LinkedList class I implemented using c++ templates. also I implemented reverse and sorting linked list by merge sort

template <class T>
void LinkedList<T>::reverseList()
{
  Node<T> *curr = head, *prev = head, *save = NULL;

  while (curr)
    {
      save = curr->next;
      curr->next = prev;
      prev = curr;
      curr = save;
    }

  head->next = NULL;
  head = prev;
}

https://code.google.com/p/medicine-cpp/source/browse/trunk/cpp/ds/LinkedList.cpp

Source Link
Medicine
  • 443
  • 5
  • 9
  • 14

here is LinkedList class I implemented using c++ templates. also I implemented reverse and sorting linked list by merge sort

https://code.google.com/p/medicine-cpp/source/browse/trunk/cpp/ds/LinkedList.cpp