public static void Main() { // Declare new linked list of type string, using Generics<T>. // Big Oh notated below in Main. SinglyLinkedList <string> ll = new SinglyLinkedList <string>(); Console.WriteLine("Populate new linked list using AddFirst, AddLast and Insert methods."); // O(1) ll.AddFirst("Three"); ll.Print(); // Create new node to insert before, O(1). Node <string> n = new Node <string>("Seven"); // AddLast by node, O(n). ll.AddLast(n); ll.Print(); // Insert 5 before the 7 node, O(n). ll.InsertBefore(n, "Five"); ll.Print(); // AddLast by value, O(n). ll.AddLast("Nine"); ll.Print(); Console.WriteLine("Remove nodes using RemoveFirst, RemoveLast, Remove(value) methods."); ll.Remove("Seven"); // O(n) ll.Print(); // O(n) ll.RemoveFirst(); // O(1) ll.Print(); ll.RemoveLast(); // O(n) ll.Print(); ll.Clear(); // O(1) Console.WriteLine("Clear linked list."); Console.WriteLine($"Linked list is Empty: {ll.IsEmpty()}"); // O(1) }