Exemple #1
0
        public void QueueUsingArrayAsUnderlyingDSTest2()
        {
            QueueUsingArrayAsUnderlyingDS arrayQueue = new QueueUsingArrayAsUnderlyingDS(maxSize: 8);

            arrayQueue.Enqueue(8);
            arrayQueue.Enqueue(12);

            Assert.Equal(expected: 8, actual: arrayQueue.Dequeue());
        }
Exemple #2
0
        public void QueueUsingArrayAsUnderlyingDSTest3()
        {
            QueueUsingArrayAsUnderlyingDS arrayQueue = new QueueUsingArrayAsUnderlyingDS(maxSize: 8);

            arrayQueue.Enqueue(8);
            arrayQueue.Enqueue(12);
            arrayQueue.Enqueue(17);
            arrayQueue.Enqueue(73);
            arrayQueue.Enqueue(19);
            arrayQueue.Enqueue(12);
            arrayQueue.Enqueue(3);
            arrayQueue.Enqueue(98);

            arrayQueue.Dequeue(); //8
            arrayQueue.Dequeue(); //12
            arrayQueue.Dequeue(); //17

            arrayQueue.Enqueue(8);

            Assert.Equal(expected: 73, actual: arrayQueue.Peek());
        }