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
public Node ReverseList(Node cur, Node prev) { if (cur == null) // if list is null return cur; Node n = cur.NextNode; cur.NextNode = prev; return (n == null) ? cur : ReverseList(n, cur); }