Beispiel #1
0
        public void LinkedListBased()
        {
            var sut = new PriorityQueueLinkedList <int>(new MaxComparer());

            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 LinkedList()
        {
            var pq = new PriorityQueueLinkedList <BenchmarkStruct>(maxComparer);

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

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