/* * private static void ParseMenuOptions(int menuOption, int menuKey, ConsoleKeyInfo cki) { * * switch (menuOption) { * case (int)reviewSubjects.ReturnToMainMenu: * exitLinkedListMenu = true; * break; * case (int)reviewSubjects.CreateLinkedList: * Console.WriteLine("Example_CreateLinkedList - created linked list\n"); * Example_CreateLinkedList(); * break; * case (int)reviewSubjects.CreateDoublyLinkedList: * Console.WriteLine("CreateDoublyLinkedList - created doubly linked list\n"); * Example_CreateDoublyLinkedList(); * break; * case (int)reviewSubjects.PrintLinkedList: * Console.WriteLine("Example_PrintLinkedList - printing linked list\n"); * Example_PrintLinkedList(); * break; * case (int)reviewSubjects.PrintLinkedListReversed: * Console.WriteLine("Example_PrintLinkedListReversed - printing linked list in reverse\n"); * Example_PrintLinkedListReversed(); * break; * case (int)reviewSubjects.PrintLinkedListRecursively: * Console.WriteLine("Example_PrintLinkedListRecursively - printing linked list recursively\n"); * Example_PrintLinkedListRecursively(); * break; * case (int)reviewSubjects.PrintLinkedListRecursivelyReversed: * Console.WriteLine("Example_PrintLinkedListRecursivelyReversed - printing linked list reversed using recursion\n"); * Example_PrintLinkedListReversed(); * break; * case (int)reviewSubjects.CreateLoopInLinkedList: * Console.WriteLine("Example_FindLoopInLinkedList - finds a loop in a linked list\n"); * Example_CreateLoopInLinkedList(); * break; * case (int)reviewSubjects.FindLoopInLinkedList: * Console.WriteLine("Example_FindLoopInLinkedList - finds a loop in a linked list\n"); * Example_FindLoopInLinkedList(); * break; * case (int)reviewSubjects.InsertNodeIntoLinkedList: * Console.WriteLine("Example_InsertNodeIntoLinkedList - inserts node into a linked list\n"); * Example_InsertNodeIntoLinkedList(); * break; * case (int)reviewSubjects.RemoveNodeFromLinkedList: * Console.WriteLine("Example_RemoveNodeFromLinkedList - removes a node from a linked list\n"); * Example_RemoveNodeFromLinkedList(); * break; * case (int)reviewSubjects.DeleteLinkedList: * Console.WriteLine("Delete Link List - deletes linked list\n"); * DeleteLinkedList(); * break; * default: * Console.WriteLine("LinkedList Menu Warning...Menu Option " + cki.KeyChar.ToString() + " not found."); * break; * } * } */ /// <summary> /// Example - Creates a Linked List /// </summary> private static void Example_CreateLinkedList() { ConsoleKeyInfo cki; bool isDouble = false; var numbers = new int[] { 1, 2, 3, 4, 5 }; Console.Write("\n\nInsert into Singly or Doubly Linked List (S/D)?: "); cki = Console.ReadKey(); if (cki.KeyChar.ToString() == "d" || cki.KeyChar.ToString() == "D") { isDouble = true; } if (isDouble) { CreateLinkedList.CreateDoublyLinkedList(numbers, out head); } else { CreateLinkedList.CreateSinglyLinkedList(numbers, out head); } }
/// <summary> /// Example - Creates a Linked List /// </summary> private static void Example_CreateDoublyLinkedList() { var numbers = new int[] { 1, 2, 3, 4, 5 }; CreateLinkedList.CreateDoublyLinkedList(numbers, out head); }