コード例 #1
0
ファイル: Program.cs プロジェクト: arorpalak/Comp212-Lab01
        static void Main(string[] args)
        {
            //testing a list of int values and getting the minimum value

            var list = new LinkedListLibrary.List <string>(); // create List container

            // create data to store in List
            // use List insert methods
            list.InsertAtFront("a"); // adding the first element or node
            list.InsertAtFront("b"); // adding the first element or node
            list.InsertAtFront("c"); // adding the first element or node
            list.InsertAtFront("d"); // adding the first element or node

            list.Display();
            Console.WriteLine($"Minimum: {list.Minimum()}");

            // testing a list of double values and getting the last element on queue

            var doubleList = new LinkedListLibrary.List <int>(); // create List container

            // create data to store in List
            // use List insert methods
            doubleList.InsertAtFront(4); // adding the first element or node
            doubleList.InsertAtFront(3); // adding the first element or node
            doubleList.InsertAtFront(7); // adding the first element or node
            doubleList.InsertAtFront(9); // adding the first element or node

            Console.WriteLine("");
            doubleList.Display();
            Console.WriteLine($"Last Element: {doubleList.GetLast()}");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: arorpalak/Comp212-Lab01
        static void Main(string[] args)                    //main method
        {
            var list = new LinkedListLibrary.List <int>(); // create List container

            // create data to store in List
            // use List insert methods
            list.InsertAtFront(5);  // adding the first element or node
            list.InsertAtFront(9);  // adding the first element or node
            list.InsertAtBack(3);   // adding the last element or node
            list.InsertAtFront(10); // adding the first element or node

            list.Display();

            list.RemoveFromFront(); //remove the first element
            list.RemoveFromBack();  //remove the last element

            list.Display();
            Console.ReadLine();
        } //end of main method