Пример #1
0
        public void MinBinaryHeapBuildTest()
        {
            MinBinaryHeap <int, int> heap = new MinBinaryHeap <int, int>();

            heap.Build(
                new BinaryHeapBase <int, int> .KeyValuePair(16, 160),
                new BinaryHeapBase <int, int> .KeyValuePair(17, 170),
                new BinaryHeapBase <int, int> .KeyValuePair(4, 40),
                new BinaryHeapBase <int, int> .KeyValuePair(3, 30),
                new BinaryHeapBase <int, int> .KeyValuePair(15, 150),
                new BinaryHeapBase <int, int> .KeyValuePair(2, 20),
                new BinaryHeapBase <int, int> .KeyValuePair(1, 10)
                );
            List <int> valueList = new List <int>();

            while (heap.Size != 0)
            {
                valueList.Add(heap.DeleteMinimumValue());
            }
            CollectionAssert.AreEqual(new int[] { 10, 20, 30, 40, 150, 160, 170 }, valueList);
        }
Пример #2
0
        public void MinBinaryHeapBuildGuardTest()
        {
            MinBinaryHeap <int, int> heap = new MinBinaryHeap <int, int>();

            heap.Build(null);
        }