Esempio n. 1
0
        public void TreeListBasedLarge()
        {
            var items  = new List <int>();
            var random = new Random();

            for (int i = 0; i < 10; i++)
            {
                items.Add(random.Next());
            }
            var pq = new PriorityQueueTree <int>(new MaxComparer());

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

            for (int i = 0; i < items.Count; i++)
            {
                pq.Dequeue();
            }
        }
Esempio n. 2
0
        public void TreeListBased()
        {
            var sut = new PriorityQueueTree <int>(new MaxComparer());

            sut.Enqueue(9);
            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());
            Assert.Equal(9, sut.Dequeue());
        }