Ejemplo n.º 1
0
 public void PrintLinkedListInReverse_Recursion(ImmutableListNode head)
 {
     if (head == null)
     {
         return;
     }
     PrintLinkedListInReverse_Recursion(head.GetNext());
     head.PrintValue();
 }
Ejemplo n.º 2
0
        public void PrintLinkedListInReverse_List(ImmutableListNode head)
        {
            var list = new List <ImmutableListNode>();

            while (head != null)
            {
                list.Add(head);
                head = head.GetNext();
            }
            for (int i = list.Count - 1; i >= 0; i--)
            {
                list[i].PrintValue();
            }
        }