コード例 #1
0
ファイル: Program.cs プロジェクト: Tayyab94/CShap_Algo
        static void Main1(string[] args)
        {
            Console.WriteLine("Hello World!");



            //Custome_Built in linked lit

            // singlyLinkedList singlyLinkedList = new singlyLinkedList();

            // singlyLinkedList.InsertFirstNode(12);
            // singlyLinkedList.InsertFirstNode(13);
            // singlyLinkedList.InsertFirstNode(14);
            // singlyLinkedList.InsertFirstNode(15);
            // singlyLinkedList.InsertFirstNode(16);

            // singlyLinkedList.Displaylist();


            // singlyLinkedList.DeleteFirst();


            // singlyLinkedList.Displaylist();
            // Console.ReadKey();



            string[] words = { "The", "Actor", "Jumped", "Over", "the", "Director" };


            LinkedList <string> sentence = new LinkedList <string>(words);

            DisplayFun(sentence, "The Linked List values");


            sentence.AddFirst("Today");
            DisplayFun(sentence, "Today is Added into the list ");


            LinkedListNode <string> mark1 = sentence.First;

            sentence.RemoveFirst();

            sentence.AddLast(mark1);
            DisplayFun(sentence, "Today is now at the last node in the lisked list node");
            Console.ReadKey();

            sentence.RemoveFirst();

            LinkedListNode <string> curret = sentence.FindLast("the");

            IndicateNode(curret, "Indicate last occurance 'The'");



            sentence.AddAfter(curret, "old");

            sentence.AddAfter(curret, "new one");
            IndicateNode(curret, "old is Added");

            curret = sentence.Find("Actor");
            IndicateNode(curret, "Test 7: Indicate the 'actor' node:");


            sentence.AddBefore(curret, "quick");
            sentence.AddBefore(curret, "skinny");
            IndicateNode(curret, "Test 8: Add 'quick' and 'skinny' before 'actor':");


            Console.ReadKey();
        }