You are viewing a single comment's thread. Return to all comments →
same here in C#:
**
public static void ReversePrint(Node head) { if (head != null) { var tempNode = head; var counter = 1; while (tempNode.Next != null) { ++counter; tempNode = tempNode.Next; } int[] arr = new int[counter]; counter = 1; tempNode = head; while (tempNode.Next != null) { arr[counter - 1] = tempNode.Data; ++counter; tempNode = tempNode.Next; } arr[counter-1] = tempNode.Data; for (int i = arr.Length - 1; i >= 0; --i) { Console.WriteLine(arr[i]); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Print in Reverse
You are viewing a single comment's thread. Return to all comments →
same here in C#:
**
**