title: Reversing single linked list in C#
body: <p>I am trying to reverse a linked list. This is the code I have come up with:</p>
  
  <pre><code> public static void Reverse(ref Node root)
   {
        Node tmp = root;
        Node nroot = null;
        Node prev = null;
  
        while (tmp != null)
        {
            //Make a new node and copy tmp
            nroot = new Node();    
            nroot.data = tmp.data;
  
            nroot.next = prev;
            prev = nroot;   
            tmp = tmp.next;
         }
         root = nroot;            
    }
  </code></pre>
  
  <p>It is working well. Was wondering if it possible to avoid creating new node. Would like to have suggestions on this.</p>