static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            PseudoQueue pseudoqueue = new PseudoQueue();

            pseudoqueue.Enqueue(3);
            pseudoqueue.Dequeue();
        }
        public void EnqueueValue()
        {
            Stack       stack  = new Stack();
            PseudoQueue pseudo = new PseudoQueue(stack);

            pseudo.Enqueque(1);

            Assert.Equal(1, pseudo.Front.Top.Value);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            PseudoQueue <int> pseudoQueue = new PseudoQueue <int>();

            //for (int i = 0; i < 6; i++)
            //{
            //    pseudoQueue.Enqueue(i + 1);
            //}
            Console.WriteLine($"Value of pseudoQueue.Dequeue(): {pseudoQueue.Dequeue().Value}");
            Console.ReadLine();
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            PseudoQueue testQueue = new PseudoQueue();

            testQueue.Enqueue(1);
            testQueue.Enqueue(4);
            testQueue.Enqueue(12);
            testQueue.Enqueue(15);

            Console.WriteLine(testQueue.Dequeue());
        }
Exemple #5
0
        static void Main(string[] args)
        {
            PseudoQueue myQueue = new PseudoQueue();

            myQueue.Enqueue(5); //this is the first value
            myQueue.Enqueue(10);
            myQueue.Enqueue(15);
            myQueue.Enqueue(20);


            Console.WriteLine(myQueue.Dequeue()); // should make the first value first, which should be 5
            Console.WriteLine(myQueue.Dequeue());
            Console.WriteLine(myQueue.Dequeue());
            Console.WriteLine(myQueue.Dequeue()); // should be the last value, which is 20
        }
Exemple #6
0
        public static void QueueWithStacks()
        {
            PseudoQueue queue = new PseudoQueue();

            queue.Enqueue(5);
            queue.Enqueue(10);
            queue.Enqueue(15);
            queue.Enqueue(20);


            Console.WriteLine(queue.PQueue.Top.Next.Next.Value);

            Console.WriteLine(queue.Dequeue());

            Console.WriteLine(queue.PQueue.Top.Next.Next.Value);
        }
        public void EnqueueValueToTheQueue()
        {
            Stack stack = new Stack();

            stack.Push(1);
            stack.Push(2);
            PseudoQueue pse = new PseudoQueue(stack);

            pse.Enqueque(8);
            while (pse.Front.Top.Next != null)
            {
                pse.Front.Top = pse.Front.Top.Next;
            }
            int res = pse.Front.Top.Value;

            Assert.Equal(8, res);
        }
        public static void QueueWithStacks()
        {
            Console.WriteLine("Starting with empty Pseudo Queue");

            Node        nodeOne           = new Node(11);
            Node        nodeTwo           = new Node(22);
            Node        nodeThree         = new Node(33);
            Node        nodeFour          = new Node(44);
            PseudoQueue carlosPseudoQueue = new PseudoQueue();

            Console.WriteLine("=======Pseudo  Enqueue======");
            Console.WriteLine($"First node added:  {carlosPseudoQueue.Enqueue(nodeOne).Value}");
            Console.WriteLine($"Second node added:  {carlosPseudoQueue.Enqueue(nodeTwo).Value}");

            Console.WriteLine("=======Pseudo  Desqueue======");
            Console.WriteLine($"Node removed:  {carlosPseudoQueue.Desqueue().Value}");
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Stack World!");

            PseudoQueue queue = new PseudoQueue();

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Enqueue(4);
            queue.Enqueue(5);

            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
        }
Exemple #10
0
        static void RunFakeQueue()
        {
            PseudoQueue fake = new PseudoQueue();

            fake.Enqueue(1);
            fake.Enqueue(2);
            fake.Enqueue(3);
            fake.Enqueue(4);
            fake.Enqueue(5);
            int[] emptied = new int[5];
            for (int i = 0; i < 5; i++)
            {
                emptied[i] = fake.Dequeue();
            }
            foreach (int num in emptied)
            {
                Console.WriteLine($"{num}");
            }
        }
        public static void QueueWithStacks()

        {
            Node  node1 = new Node(4);
            Stack stack = new Stack(node1);

            stack.Push(4);
            stack.Push(3);
            stack.Push(2);
            stack.Push(1);
            PseudoQueue pseuedo = new PseudoQueue(stack);

            pseuedo.Print(stack);
            pseuedo.Enqueque(6);
            Console.WriteLine(" xxxxxxxxxxxxxxxxxxxxxxxxxxx");

            pseuedo.Print(stack);
            Console.WriteLine("xxxxxxxxxxxxxxxxxxxxx");
            Console.WriteLine("afterDeque");
            pseuedo.Dequeue();
            pseuedo.Print(stack);
        }