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
Node p = root, n = null; while (p != null) { Node tmp = p.next; p.next = n; n = p; p = tmp; } root = n;