//Iterate through first list until you get to end //Set pointer of last node in first list equal to head of list2 public static void Append(LinkedListStack list1, LinkedListStack list2) { Node cur = list1.head; while (cur.Next != null) cur = cur.Next; cur.Next = list2.head; }
static void Main(string[] args) { LinkedListStack s = new LinkedListStack(); s.Push(4); s.Push(5); s.Push(6); s.Push(7); s.TestDeleteMiddle(2);// .DeleteMid2(2); //s.TestDeleteMiddle(3); //Deletes 5 from the stack Console.WriteLine(s.Pop()); Console.WriteLine(s.Pop()); Console.WriteLine(s.Pop()); Console.WriteLine(s.Pop()); //Console.WriteLine(s.Pop()); //Console.WriteLine(s.Pop()); }