示例#1
0
        static void Main(string[] args)
        {
            Random rand = new Random();

            DoublyLinkedList testList = new DoublyLinkedList();

            for (int i = 0; i < 11; i++)
            {
                testList.Add(i);
            }

            // testList.PrintValues();
            // Console.WriteLine("===========================");
            // Console.WriteLine(testList.Remove(10));
            // testList.PrintValues();

            testList.PrintValues();
            Console.WriteLine("===========================");
            testList.Reverse();
            testList.PrintValues();
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            //create a function, takes in a int by ref and modify and print
            //int temp = 10;
            //Console.WriteLine(temp);
            //addTen(ref temp);
            //Console.WriteLine(temp);
            //Console.ReadLine();

            DoublyLinkedList <int> doublyLinkedList = new DoublyLinkedList <int>();

            doublyLinkedList.AddFirst(10);
            doublyLinkedList.AddFirst(11);
            doublyLinkedList.AddLast(23);
            doublyLinkedList.AddAfer(doublyLinkedList.Search(11), 59);
            doublyLinkedList.RemoveFirst();
            doublyLinkedList.RemoveLast();
            doublyLinkedList.AddBefore(doublyLinkedList.Search(10), 12);
            doublyLinkedList.Remove(12);
            ;
        }
示例#3
0
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            DoublyLinkedList newList = new DoublyLinkedList();

            for (int i = 1; i <= 1; i++)
            {
                newList.Add(i);
            }
            // Console.WriteLine("--------------------------------------------------");
            // // Console.WriteLine(newList.Size());
            // Console.WriteLine("--------------------------------------------------");
            // // newList.Pop();
            newList.PrintVals();
            // Console.WriteLine
            // ("--------------------------------------------------");
            // Console.WriteLine("--------------------------------------------------");
            // Console.WriteLine(newList.Size());
            Console.WriteLine("--------------------------------------------------");
            newList.Reverse();
            newList.PrintVals();
        }