title: Sort Ascending - Linked List
body: <p>I'm having a little trouble with getting my head around how this function would work and what I need to do. I have int number as my data type and  node* next in my node class. I also have node pointers head, current and temp. My question is how would I go about getting my list of integers into order? Also how does ascending and decending work in a single linked list?</p>
  
  <p>My header file:</p>
  
  <pre><code>#ifndef SDI_LL                      
  #define SDI_LL                      
  
  namespace SDI
  {                                                       
  
      class LinkedList                                                                    
      {
          class Node                                      
          {
          public:
              int number;                                 //data element
              Node* next;                                 //pointer to next, node inside each node
          private:
  
          };
  
      private:
  
          Node *head;
          Node *current;                                  //head, current and temp node pointers
          Node *temp;
  
      public:
          LinkedList();                                   //constructor to access nodes from above
          ~LinkedList();                                  //destructor
  
          void insert(int add);                           
          void remove(int remove);                        //functions that access private data nodes above
          void display();
          void reverse();
          void search(int searchNum);
          void sortAscending();
          void sortDecending();
          void saveAll();
          void restoreAll();
  
      };
  
  }
  #endif
  </code></pre>
  
  <p>My ascending function so far where it starts from the beginning and searches through the list:</p>
  
  <pre><code>void LinkedList::sortAscending()
  {
      current = head;
      for (current = head; current;)
      {
          temp = current;
          current = current-&gt;next;
  
      }
  }
  </code></pre>