static void Main(string[] args) { var list = new DoublyLinkedList <string>(); list.AddFirst("a"); list.AddFirst("b"); list.AddLast("c"); list.AddAfter(list.FirstNode, "u"); list.AddBefore(list.LastNode, "p"); list.Remove(list.FindFirst("b")); list.Reverse(); foreach (var node in list) { Console.WriteLine(node.Data); } Console.WriteLine("Press any key..."); Console.ReadKey(); }
private static void PrintDoublyLinkedListOutput() { var ll = new DoublyLinkedList <int>(); ll.Add(3); ll.Add(7); ll.Add(9); ll.Add(12); Console.WriteLine(ll.Count); var isContain = ll.Contains(7); Console.WriteLine("Is Contain: " + isContain); foreach (int value in ll) { Console.Write(value); } Console.ReadKey(); }