title: c++ reverse a linkedlist without changing the original one
body: <p>I'm trying to reverse a linkedlist, but I don't want to change the original linkedlist passed in by reference, how can I solve it?</p>
  
  <pre><code>typedef Node * ListType 
  
  ListType reverse(ListType list) {
     if (list == NULL) {
        return list;
     }
     ListType curr = list;
     //printList(list);               //list unchanged 
     ListType prev=NULL, next=NULL;
     while (curr != NULL) {     
        next = curr-&gt;next;
        curr-&gt;next = prev;
        prev = curr;
        curr = next;  
     }
     //printList(list);              //list changed(I dont't want it changed)
     return prev;
  }
  </code></pre>