I am trying to reverse a linked list. This is the code I have come up with:
public static void Reverse(ref Node root) { Node tmp = root; Node n
You don't need to make a copy. Some pseudo code:
prev = null; current = head; next = current->next; (while next != null) current->next=prev prev=current current=next next=current->next