Ejemplo n.º 1
0
        public void CStackTest()
        {
            CStack cs = new CStack();

            Assert.AreEqual(cs.X, 0);
            Assert.AreEqual(cs.Y, 0);
            Assert.AreEqual(cs.Z, 0);
            Assert.AreEqual(cs.T, 0);
            string[,] _address = new string[8, 2] {
                { "A", "0" },
                { "B", "0" },
                { "C", "0" },
                { "D", "0" },
                { "E", "0" },
                { "F", "0" },
                { "G", "0" },
                { "H", "0" }
            };

            for (int i = 0; i < _address.GetLength(0); i++)
            {
                Assert.AreEqual(cs.address[i, 0], _address[i, 0]);
                Assert.AreEqual(cs.address[i, 1], _address[i, 1]);
            }
            Assert.AreEqual(cs.entry, "");
            Assert.AreEqual(cs.entryVar, "");
        }
Ejemplo n.º 2
0
        public void SetAddressTest()
        {
            CStack cs = new CStack();

            cs.SetAddress("A");
            Assert.AreEqual(cs.entryVar, "A");
        }
Ejemplo n.º 3
0
        public void SetXTest()
        {
            CStack cs = new CStack();

            cs.SetX(10);
            Assert.AreEqual(cs.X, 10);
        }
Ejemplo n.º 4
0
        public void EntryAddCommaTest()
        {
            CStack cs = new CStack();

            cs.EntryAddComma();
            Assert.AreNotEqual(cs.entry.IndexOf(","), -1);
        }
Ejemplo n.º 5
0
        public void SaveVarInFileTest()
        {
            //var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @".\variabelFile.txt";
            CStack cs = new CStack(@".\variabelFile.txt");

            Assert.AreEqual(true, cs.fileExist);
            cs.address = new string[8, 2] {
                { "A", "1" },
                { "B", "2" },
                { "C", "3" },
                { "D", "4" },
                { "E", "5" },
                { "F", "6" },
                { "G", "7" },
                { "H", "8" }
            };
            cs.X = 8;
            cs.Y = 7;
            cs.Z = 6;
            cs.T = 5;
            cs.SaveVarInFile();

            CStack cs2 = new CStack(@".\variabelFile.txt");

            Assert.AreEqual(true, cs.fileExist);
            for (int i = 0; i < cs2.address.GetLength(0); i++)
            {
                Assert.AreEqual(cs2.address[i, 0], cs.address[i, 0]);
                Assert.AreEqual(cs2.address[i, 1], cs.address[i, 1]);
            }
            Assert.AreEqual(cs2.X, cs.X);
            Assert.AreEqual(cs2.Y, cs.Y);
            Assert.AreEqual(cs2.Z, cs.Z);
            Assert.AreEqual(cs2.T, cs.T);
        }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        CStack <int> tStack = new CStack <int>();

        tStack.Push(5);
        tStack.Push(10);

        int ta = tStack.Pop();
        int tb = tStack.Pop();

        Debug.Log(ta);
        Debug.Log(tb);


        int tA_0 = 5;
        int tB_0 = 777;

        DoSwap(ref tA_0, ref tB_0);
        Debug.Log(tA_0);
        Debug.Log(tB_0);

        //런타임이 추론에 헷갈리지 않게 표기하여 지정해줄 수도 있다.
        DoSwap <int>(ref tA_0, ref tB_0);
        Debug.Log(tA_0);
        Debug.Log(tB_0);
    }
Ejemplo n.º 7
0
        static void Compute(CStack N, CStack O)
        {
            int    operand1;
            int    operand2;
            string oper;

            operand1 = Convert.ToInt32(N.Pop());
            operand2 = Convert.ToInt32(N.Pop());
            oper     = Convert.ToString(O.Pop());
            switch (oper)
            {
            case "+":
                N.Push(operand1 + operand2);
                break;

            case "-":
                N.Push(operand1 - operand2);
                break;

            case "*":
                N.Push(operand1 * operand2);
                break;

            case "/":
                N.Push(operand1 / operand2);
                break;
            }
        }
Ejemplo n.º 8
0
        static void Calculate(CStack N, CStack O, string exp)
        {
            string ch;
            string token = string.Empty;

            for (int p = 0; p < exp.Length; p++)
            {
                ch = exp.Substring(p, 1);
                if (IsNumber(ch) == true)
                {
                    token += ch;
                }
                if (ch == " " || p == (exp.Length - 1))
                {
                    if (IsNumber(token))
                    {
                        N.Push(token);
                        token = string.Empty;
                    }
                }
                else if (ch == "+" || ch == "-" || ch == "*" || ch == "/")
                {
                    O.Push(ch);
                }
                if (N.Count == 2)
                {
                    Compute(N, O);
                }
            }
        }
Ejemplo n.º 9
0
        public void EntryAddNumTest()
        {
            CStack cs = new CStack();

            cs.EntryAddNum("5");
            Assert.AreEqual(cs.entry, "5");
        }
Ejemplo n.º 10
0
        public void VarStringTest()
        {
            CStack cs       = new CStack();
            string stack    = cs.VarString();
            string stackVar = "0\n0\n0\n0\n0\n0\n0\n0";

            Assert.AreEqual(stack, stackVar);
        }
Ejemplo n.º 11
0
        public void StackStringTest()
        {
            CStack cs        = new CStack();
            string stack     = cs.StackString();
            string stackTest = "0\n0\n0\n0\n";

            Assert.AreEqual(stack, stackTest);
        }
Ejemplo n.º 12
0
        public void EnterTest()
        {
            CStack cs = new CStack();

            cs.entry = "5";
            cs.Enter();
            Assert.AreEqual(cs.X, 5);
            Assert.AreEqual(cs.entry, "");
        }
Ejemplo n.º 13
0
        public void BinOpTest()
        {
            CStack cs = new CStack();

            cs.entry = "5";
            cs.Enter();
            cs.entry = "5";
            cs.Enter();
            cs.BinOp("+");
            Assert.AreEqual(cs.X, 10);

            CStack cs2 = new CStack();

            cs2.entry = "15";
            cs2.Enter();
            cs2.entry = "5";
            cs2.Enter();
            cs2.BinOp("-");
            Assert.AreEqual(cs2.X, 5);

            CStack cs3 = new CStack();

            cs3.entry = "2";
            cs3.Enter();
            cs3.entry = "5";
            cs3.Enter();
            cs3.BinOp("*");
            Assert.AreEqual(cs3.X, 5);

            CStack cs4 = new CStack();

            cs4.entry = "10";
            cs4.Enter();
            cs4.entry = "2";
            cs4.Enter();
            cs4.BinOp("÷");
            Assert.AreEqual(cs4.X, 5);

            CStack cs5 = new CStack();

            cs5.entry = "5";
            cs5.Enter();
            cs5.entry = "2";
            cs5.Enter();
            cs5.BinOp("yˣ");
            Assert.AreEqual(cs5.X, 25);

            CStack cs6 = new CStack();

            cs6.entry = "9";
            cs6.Enter();
            cs6.entry = "2";
            cs6.Enter();
            cs6.BinOp("ˣ√y");
            Assert.AreEqual(cs6.X, 3);
        }
Ejemplo n.º 14
0
        public void SetVarTest()
        {
            CStack cs = new CStack();

            cs.entry = "20";
            cs.Enter();
            cs.SetAddress("A");
            cs.SetVar();
            Assert.AreEqual(cs.address[0, 1], "20");
        }
Ejemplo n.º 15
0
        public void GetVarTest()
        {
            CStack cs = new CStack();

            cs.entry = "1";
            cs.Enter();
            cs.SetAddress("A");
            cs.SetVar();

            cs.entry = "2";
            cs.Enter();
            cs.SetAddress("B");
            cs.SetVar();

            cs.entry = "3";
            cs.Enter();
            cs.SetAddress("C");
            cs.SetVar();

            cs.entry = "4";
            cs.Enter();
            cs.SetAddress("D");
            cs.SetVar();

            cs.entry = "5";
            cs.Enter();
            cs.SetAddress("E");
            cs.SetVar();

            cs.entry = "6";
            cs.Enter();
            cs.SetAddress("F");
            cs.SetVar();

            cs.entry = "7";
            cs.Enter();
            cs.SetAddress("G");
            cs.SetVar();

            cs.entry = "8";
            cs.Enter();
            cs.SetAddress("H");
            cs.SetVar();

            cs.GetVar();
            Assert.AreEqual(cs.address[0, 1], "1");
            Assert.AreEqual(cs.address[1, 1], "2");
            Assert.AreEqual(cs.address[2, 1], "3");
            Assert.AreEqual(cs.address[3, 1], "4");
            Assert.AreEqual(cs.address[4, 1], "5");
            Assert.AreEqual(cs.address[5, 1], "6");
            Assert.AreEqual(cs.address[6, 1], "7");
            Assert.AreEqual(cs.address[7, 1], "8");
        }
Ejemplo n.º 16
0
        public GameEntryUI()
        {
            this.InitializeComponent();

            CStack lifeStack = new CStack();

            lifeStack.Push(3);
            lifeStack.Push(2);
            lifeStack.Push(1);
            int popped = lifeStack.Pop();
            int check  = lifeStack.Peek();
        }
Ejemplo n.º 17
0
        public void TestMethodStackPush()
        {
            CStack <string> s = new CStack <string>();

            Assert.AreEqual(s.Size, 0);
            s.Push("a");
            Assert.AreEqual(s.Size, 1);
            Assert.AreEqual(s.Top(), "a");
            s.Push("b");
            Assert.AreEqual(s.Size, 2);
            Assert.AreEqual(s.Top(), "b");
        }
Ejemplo n.º 18
0
        public void NilopTest()
        {
            CStack cs = new CStack();

            cs.Nilop("π");
            Assert.AreEqual(cs.X, 3, 14);

            CStack cs2 = new CStack();

            cs2.Nilop("e");
            Assert.AreEqual(cs.X, 2, 71828182845904);
        }
Ejemplo n.º 19
0
        public void RollTest()
        {
            CStack cs = new CStack();

            cs.X = 1;
            cs.Y = 2;
            cs.Z = 3;
            cs.T = 4;
            cs.Roll();
            Assert.AreEqual(cs.X, 4);
            Assert.AreEqual(cs.Y, 1);
            Assert.AreEqual(cs.Z, 2);
            Assert.AreEqual(cs.T, 3);
        }
Ejemplo n.º 20
0
        public void EntryChangeSignTest()
        {
            CStack cs = new CStack();

            cs.entry = "5";
            cs.EntryChangeSign();
            Assert.AreEqual(cs.entry, "-5");
            cs.EntryChangeSign();
            Assert.AreEqual(cs.entry, "+5");

            cs.entry = "5";
            cs.Enter();
            cs.EntryChangeSign();
            Assert.AreEqual(cs.entry, "-");
        }
Ejemplo n.º 21
0
    public Graph()
    {
        vertices  = new Vertex[NUM_VERTICES];
        adjMatrix = new int[NUM_VERTICES, NUM_VERTICES];
        numVerts  = 0;
        for (int j = 0; j < NUM_VERTICES; j++)
        {
            for (int k = 0; k < NUM_VERTICES; k++)
            {
                adjMatrix[j, k] = 0;
            }
        }

        gStack = new CStack();
    }
Ejemplo n.º 22
0
    public static void Main(string[] args)
    {
        while (true)
        {
            CStack alist = new CStack();
            string ch;

            Console.WriteLine("Please enter a word to check if it is a palindrome. Enter the letter \"x\" to exit the program.");
            string word = Console.ReadLine();
            if (word.Equals("X") || word.Equals("x"))
            {
                break;
            }
            else
            {
                //string word = "seen";
                bool isPalindrome = true;
                for (int x = 0; x < word.Length; x++)
                {
                    alist.push(word.ToLower().Substring(x, 1));
                }

                int pos = 0;
                while (alist.count > 0)
                {
                    ch = alist.pop().ToString();
                    if (ch != word.ToLower().Substring(pos, 1))
                    {
                        isPalindrome = false;
                        break;
                    }
                    pos++;
                }

                if (isPalindrome && !word.Trim().Equals(""))
                {
                    Console.WriteLine(word + " is a palindrome.");
                }
                else
                {
                    Console.WriteLine(word + " is not a palindrome.");
                }

                Console.ReadKey();
            }
        }
    }
Ejemplo n.º 23
0
 static void Main(string[] args)
 {
     try
     {
         CStack nums = new CStack();
         CStack ops  = new CStack();
         Console.WriteLine("Enter a math equation with proper spacing.");
         string expression = Console.ReadLine();
         Calculate(nums, ops, expression);
         Console.WriteLine("\n" + nums.Pop());
         Console.ReadLine();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Invalid characters entered.");
         Console.ReadLine();
     }
 }
Ejemplo n.º 24
0
        public void DropTest()
        {
            CStack cs = new CStack();

            cs.entry = "1";
            cs.Enter();
            cs.entry = "2";
            cs.Enter();
            cs.entry = "3";
            cs.Enter();
            cs.entry = "4";
            cs.Enter();
            cs.Drop();
            Assert.AreEqual(cs.X, 3);
            Assert.AreEqual(cs.Y, 2);
            Assert.AreEqual(cs.Z, 1);
            Assert.AreEqual(cs.T, 0);
        }
Ejemplo n.º 25
0
        public void TestMethodStackPop()
        {
            CStack <string> s = new CStack <string>();

            Assert.AreEqual(s.Size, 0);
            s.Push("a");
            s.Push("b");
            s.Push("c");
            Assert.AreEqual(s.Top(), "c");
            s.Pop();
            Assert.AreEqual(s.Top(), "b");
            s.Pop();
            Assert.AreEqual(s.Top(), "a");

            s.Pop();
            Assert.IsTrue(s.IsEmpty());
            Assert.ThrowsException <Exception>(() => s.Top());
            Assert.ThrowsException <Exception>(() => s.Pop());
        }
Ejemplo n.º 26
0
        public static void RunStack()
        {
            CStack <int> s = new CStack <int>();

            for (int i = 1; i <= 3; i++)
            {
                s.Push(i);
            }
            Console.WriteLine(s);
            s.Pop();
            Console.WriteLine(s);
            s.Pop();
            Console.WriteLine(s);
            s.Pop();
            Console.WriteLine(s);

            Console.WriteLine(s.Size);
            Console.WriteLine(s.IsEmpty());

            //Console.ReadLine();
        }
Ejemplo n.º 27
0
        public void RollSetXTest()
        {
            CStack cs = new CStack();

            cs.entry = "1";
            cs.Enter();
            cs.entry = "2";
            cs.Enter();
            cs.entry = "3";
            cs.Enter();

            Assert.AreEqual(cs.T, 0);
            Assert.AreEqual(cs.Z, 1);
            Assert.AreEqual(cs.Y, 2);
            Assert.AreEqual(cs.X, 3);

            cs.RollSetX(4);
            Assert.AreEqual(cs.T, 1);
            Assert.AreEqual(cs.Z, 2);
            Assert.AreEqual(cs.Y, 3);
            Assert.AreEqual(cs.X, 4);
        }
Ejemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        CStack <int> tStack = new CStack <int>();

        tStack.Push(5);
        tStack.Push(10);
        int tA = tStack.Pop();
        int tB = tStack.Pop();


        Debug.Log(tA);
        Debug.Log(tB);

        int tA_0 = 5;
        int tB_0 = 777;

        DoSwap(ref tA_0, ref tB_0);
        Debug.Log(tA_0);
        Debug.Log(tB_0);

        DoSwap <int>(ref tA_0, ref tB_0);
        Debug.Log(tA_0);
        Debug.Log(tB_0);
    }
Ejemplo n.º 29
0
        // Start is called before the first frame update
        void Start()
        {
            // 제네틱 사용하지 않았을때 스택을 사용하는 코드

            int          size   = 5;
            CStack <int> istack = new CStack <int>(size);


            for (int i = 0; i < 7; i++)
            {
                if (!istack.IsFull())
                {
                    istack.Push(i);
                }
                else
                {
                    Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
                }
            }

            while (!istack.IsEmpty())
            {
                Debug.Log(istack.Pop());
            }



            CStack <float> fstack = new CStack <float>(size);

            for (int i = 0; i < 7; i++)
            {
                if (!fstack.IsFull())
                {
                    fstack.Push(i * 1.2f);
                }
                else
                {
                    Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
                }
            }

            while (!fstack.IsEmpty())
            {
                Debug.Log(fstack.Pop());
            }



            CStack <string> sstack = new CStack <string>(size);

            for (int i = 0; i < 7; i++)
            {
                if (!sstack.IsFull())
                {
                    sstack.Push(i + "번");
                }
                else
                {
                    Debug.Log("스택이 꽉 찼습니다. [저장 실패 : " + i + "]");
                }
            }

            while (!sstack.IsEmpty())
            {
                Debug.Log(sstack.Pop());
            }
        }
        static void Main(string[] args)
        {
            LinkedList <int> ll = new LinkedList <int>();
            TimerPerformance tp = new TimerPerformance();

            tp.StartTiming();
            ll.AddNode(1);
            Console.WriteLine($"Time for adding \"1\": {tp.StopTiming()}");
            ll.AddNode(2);
            ll.AddNode(3);
            ll.AddNode(4);
            ll.AddNode(5);
            ll.AddNode(6);
            ll.AddNode(7);
            ll.AddNode(8);
            tp.StartTiming();
            ll.AddNode(9);
            Console.WriteLine($"Time for adding \"9\": {tp.StopTiming()}");
            ll.AddNode(10);
            ll.AddNode(11);
            ll.AddNode(12);
            ll.AddNode(13);
            ll.AddNode(14);
            ll.AddNode(15);
            ll.AddNode(16);
            ll.AddNode(17);
            tp.StartTiming();
            ll.AddNode(18);
            Console.WriteLine($"Time for adding \"18\": {tp.StopTiming()}");

            Console.WriteLine("-------------------------DOUBLY LINKED LISTS-------------");

            var doubleLL = new DoublyLinkedList <int>();

            doubleLL.AddNode(1);
            doubleLL.AddNode(2);
            doubleLL.AddNode(3);
            doubleLL.AddNode(4);
            doubleLL.AddNode(5);
            doubleLL.AddNode(6);
            doubleLL.AddNode(7);
            doubleLL.AddNode(8);
            doubleLL.AddNode(9);
            doubleLL.AddNode(10);
            doubleLL.AddNode(11);
            doubleLL.AddNode(12);
            doubleLL.AddNode(13);
            doubleLL.AddNode(14);
            doubleLL.AddNode(15);
            doubleLL.AddNode(16);
            doubleLL.AddNode(17);
            doubleLL.AddNode(18);
            foreach (var item in doubleLL)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            Console.WriteLine("-----------Previous value of node with value \"3\"------------");
            Console.WriteLine(((DoubleNode <int>)doubleLL.HeadNode.NextNode.NextNode).PreviousNode.Value);

            Console.WriteLine($"\nDeleteAt(3)");
            doubleLL.DeleteAt(3);

            //foreach(var item in doubleLL)
            //    Console.WriteLine(item);

            foreach (var item in doubleLL)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("\nPrevious node of element at 3rd index: ");
            Console.Write((doubleLL.HeadNode.NextNode.NextNode.NextNode as DoubleNode <int>).PreviousNode.Value);

            Console.WriteLine();
            Console.WriteLine("Merge nodes and multiply values for singly linked list -----------------");
            Console.WriteLine();

            MergeNodesAndMultValues(ll.HeadNode);

            foreach (var item in ll.ReadValues())
            {
                Console.WriteLine(item);
            }

            //Console.WriteLine($"\nValue of the previous node in singly linked list: {ll.HeadNode.NextNode.NextNode.Value}");

            Console.WriteLine("STACK DATA STRUCTURE ----------------------");

            CStack <int> stack = new CStack <int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            stack.Push(4);
            stack.Push(5);
            stack.Push(7);
            stack.Push(8);
            stack.Push(9);
            stack.Push(10);
            stack.Push(11);
            stack.Push(12);

            Console.WriteLine("\ncontinuous .Pop() calls");
            Console.WriteLine();

            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            stack.Pop();
            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            stack.Pop();
            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            stack.Pop();
            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("\nSTACK DATA STRUCTURE WITH LINKED LIST ----------------------");

            LLStack <int> llStack = new LLStack <int>();

            llStack.Push(1);
            llStack.Push(2);
            llStack.Push(3);
            llStack.Push(4);
            llStack.Push(5);
            llStack.Push(6);
            llStack.Push(7);
            llStack.Push(8);
            llStack.Push(9);
            llStack.Push(10);

            Console.WriteLine("Read llStack values----------");
            Console.WriteLine();

            foreach (var item in llStack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("llStack.Pop()");
            llStack.Pop();

            foreach (var item in llStack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("llStack.Pop()");
            llStack.Pop();

            foreach (var item in llStack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("llStack.Push(11)");
            llStack.Push(11);

            foreach (var item in llStack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();
            Console.WriteLine("Intersecting node------");

            LinkedList <int> l1 = new LinkedList <int>(), l2 = new LinkedList <int>();

            l1.AddNode(1);
            l1.AddNode(2);
            l1.AddNode(3);
            l1.AddNode(4);
            l1.AddNode(7);
            l1.AddNode(8);
            l1.AddNode(9);
            l2.AddNode(2);
            l2.AddNode(4);
            Console.WriteLine(LinkedList <int> .FindIntesectingNode(l1, l2));

            l1.GetNthReverseNode(1);
            foreach (var item in l1)
            {
                Console.WriteLine(item);
            }


            //QUEUE
            //Console.WriteLine("\nQUEUE DATA STRUCTURE USAGE\n");
            //CQueue<int> queue = new CQueue<int>();
            //queue.Enqueue(1);
            //queue.Enqueue(3);
            //queue.Enqueue(2);
            //queue.Enqueue(4);
            //queue.Enqueue(5);
            //queue.Enqueue(6);
            //queue.Enqueue(7);
            //queue.Enqueue(8);
            //queue.Enqueue(7);
            //queue.Dequeue();
            //queue.Dequeue();
            //queue.Enqueue(9);
            //queue.Enqueue(10);
            //queue.Enqueue(11);
            //foreach (var item in queue)
            //    Console.WriteLine(item);

            //Console.WriteLine("queue.Dequeue() * 3");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");
            //Console.WriteLine($"ITEM REMOVED: {queue.Dequeue()}");

            //Console.WriteLine($"\nqueue.IsEmpty(): {queue.IsEmpty()}");
            //foreach (var item in queue)
            //    Console.WriteLine(item);


            //Console.WriteLine("LLQueue USAGE----------------\n");
            //LLQueue<int> queue2 = new LLQueue<int>();
            //queue2.Enqueue(1);
            //queue2.Enqueue(2);
            //queue2.Enqueue(3);
            //queue2.Enqueue(4);
            //queue2.Enqueue(5);
            //queue2.Enqueue(6);
            //queue2.Enqueue(7);
            //queue2.Enqueue(8);
            //queue2.Enqueue(9);
            //Console.WriteLine();
            //queue2.PrintElems();
            //Console.WriteLine();
            //queue2.Dequeue();
            //queue2.Dequeue();
            //queue2.PrintElems();
            //Console.WriteLine();
            //queue2.Enqueue(10);
            //queue2.PrintElems();

            //BST
            Console.WriteLine("Binary Search Tree in ACTION!----------");
            BinarySearchTree bst = new BinarySearchTree();

            //bst.AddNode(6);
            //bst.AddNode(3);
            //bst.AddNode(9);
            //bst.AddNode(1);
            //bst.AddNode(8);
            //bst.AddNode(4);
            //bst.AddNode(10);    ITERATIVE APROACH, BETTER

            bst.AddNodeRecursive(6);
            bst.AddNodeRecursive(3);
            bst.AddNodeRecursive(9);
            bst.AddNodeRecursive(1);
            bst.AddNodeRecursive(8);
            bst.AddNodeRecursive(4);
            bst.AddNodeRecursive(10);
            bst.AddNodeRecursive(7);

            Console.Write("\nbst.ExistNode(4)? -> ");
            Console.WriteLine(bst.ExistNode(4));

            tp.StartTiming();
            Console.Write("\nbst.ExistNode(11)? -> ");
            Console.WriteLine(bst.ExistNode(11));
            Console.WriteLine($"TIME TAKEN IN ExistNode() OPERATION: {tp.StopTiming()}");

            Console.Write("\nbst.ExistNode(10)? -> ");
            Console.WriteLine(bst.ExistNode(10));


            //USE OF BFS AND DFS ALGORITHMS TO TRAVERSE THE TREE
            Console.WriteLine("using BFS and DFS ---------------------------");
            List <int> bfs = new List <int>();

            bst.TraverseDFSPreorder(bfs, bst.Root);
            foreach (var item in bfs)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            bfs.Clear();
            bst.TraverseDFSPreorderIterative(bfs);
            foreach (var item in bfs)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("\nGiven a BT, return the sum of all the depths for all the nodes in it\nSOLUTION");
            BinarySearchTree bst2 = new BinarySearchTree();

            bst2.AddNode(4);
            bst2.AddNode(2);
            bst2.AddNode(6);
            bst2.AddNode(1);
            bst2.AddNode(3);
            bst2.AddNode(7);
            bst2.AddNode(5);

            Console.WriteLine(bst2.SumDepths());

            BSTNode <int> rootNode = new BSTNode <int>(5);

            rootNode.LeftRoot            = new BSTNode <int>(3);
            rootNode.RightRoot           = new BSTNode <int>(8);
            rootNode.RightRoot.LeftRoot  = new BSTNode <int>(7);
            rootNode.RightRoot.RightRoot = new BSTNode <int>(9);
            rootNode.LeftRoot.RightRoot  = new BSTNode <int>(4);
            rootNode.LeftRoot.LeftRoot   = new BSTNode <int>(2);

            Console.WriteLine($"\nIs Binary Search Tree the following tree?: {bst2.IsBST(rootNode)}");

            Console.WriteLine($"\nBinarySearchTreee.GetPredecessor(4): {bst2.GetPredecessor(4).Value}");
            Console.WriteLine($"\nBinarySearchTreee.GetSucessor(3): {bst2.GetSuccesor(3).Value}");

            Console.WriteLine("\nBinarySearchTree.DeleteNode(6)");
            bst2.DeleteNode(bst2.Root, 6);

            bst2.AddNode(6);
            Console.WriteLine("\nBinarySearchTree.DeleteNodeMCD(6)");
            bst2.DeleteNodeMCD(bst2.Root, 6);

            bst2.AddNode(6);

            //Graphs

            Console.WriteLine("Graphs---------------------------");
            EdgeListGraph <int> undirectedGraph = new EdgeListGraph <int>();

            undirectedGraph.vertices = new int[] { 1, 2, 3, 4 };
            undirectedGraph.edges    = new Edge[] { new Edge(0, 1), new Edge(0, 3), new Edge(2, 1), new Edge(2, 3) };
            Console.WriteLine("undirectedGraph.GetAdyacentNodes(4): ");
            undirectedGraph.GetAdyacentNodes(4);

            //Heaps

            Console.WriteLine("Min Heap ds-----------");
            MinHeap minHeap = new MinHeap(10);

            minHeap.Insert(7);
            minHeap.Insert(3);
            minHeap.Insert(6);
            minHeap.Remove();
            minHeap.Insert(1);
            minHeap.Insert(2);
            minHeap.Remove();
            minHeap.Insert(5);
            minHeap.Insert(4);

            foreach (var item in minHeap)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("-Max Heap--------------------------------");

            MaxHeap maxHeap = new MaxHeap(10);

            maxHeap.Insert(2);
            maxHeap.Insert(1);
            maxHeap.Insert(4);
            maxHeap.Remove();
            maxHeap.Insert(2);
            maxHeap.Insert(1);
            maxHeap.Insert(9);
            maxHeap.Remove();
            Console.WriteLine(maxHeap.Peek() == 2);

            foreach (var item in maxHeap)
            {
                Console.WriteLine(item);
            }
        }