Пример #1
0
        private static void PopElements <T>(PriorityQueue <T> pq)
        {
            int size = pq.Size();

            for (int i = 0; i < size; i++)
            {
                pq.Pop();
            }
        }
Пример #2
0
        private static void PopAndTestElements <T>(PriorityQueue <T> pq, T[] elements)
        {
            int size = pq.Size();

            for (int i = 0; i < size; i++)
            {
                Assert.AreEqual(pq.Pop(), elements[i]);
            }
        }
Пример #3
0
        private static void PopAndTestElements <T>(PriorityQueue <T> pq)
        {
            int size = pq.Size();
            T   last = pq.Pop();

            for (int i = 1; i < size; i++)
            {
                T next = pq.Pop();
                Assert.IsTrue(pq.LessThan(last, next));
                last = next;
            }
        }
Пример #4
0
 private static void AddAndTest <T>(PriorityQueue <T> pq, T element, T expectedTop, int expectedSize)
 {
     pq.Add(element);
     Assert.AreEqual(pq.Top(), expectedTop);
     Assert.AreEqual(pq.Size(), expectedSize);
 }