public static void Main(string[] args)
var second = new Node(2);
var fourth = new Node(4);
Console.WriteLine("=============== After swapping ===============");
static void Reverse(ref Node head)
Node node = head, prev = null, next = null;
Console.WriteLine(node.Data);
public int GetLengthIterative()
public int GetLengthRecursive()
return 1 + this.Next.GetLengthRecursive();
public override string ToString()