Exemplo n.º 1
0
        public void ArrayBased()
        {
            var sut = new PriorityQueueArray <int>(new MaxComparer(), 10);

            sut.Enqueue(15);
            sut.Enqueue(14);
            sut.Enqueue(11);
            sut.Enqueue(10);
            sut.Enqueue(12);
            Assert.Equal(15, sut.Dequeue());
            Assert.Equal(14, sut.Dequeue());
            Assert.Equal(12, sut.Dequeue());
            Assert.Equal(11, sut.Dequeue());
            Assert.Equal(10, sut.Dequeue());
        }
        public void Array()
        {
            var pq = new PriorityQueueArray <BenchmarkStruct>(maxComparer, N);

            foreach (var item in randomItems)
            {
                pq.Enqueue(item);
            }

            for (int i = 0; i < randomItems.Count; i++)
            {
                pq.Dequeue();
            }
        }