Beispiel #1
0
        public void BuildMaxHeapTest2()
        {
            var array    = new[] { 11, 19, 71, 34, 47, 38, 55, 1, 33, 69 };
            var expected = new[] { 71, 69, 55, 34, 47, 38, 11, 1, 33, 19 };

            HeapHelper.BuildMaxHeap(array);

            Console.WriteLine("Expected: {0}", string.Join(", ", expected));
            Console.WriteLine("  Actual: {0}", string.Join(", ", array));
            CollectionAssert.AreEqual(expected, array);
        }
Beispiel #2
0
        public void BuildMaxHeapTest()
        {
            var array    = new[] { 1, 5, 4, 6, 7, 9, 3 };
            var expected = new[] { 9, 7, 4, 6, 5, 1, 3 };

            HeapHelper.BuildMaxHeap(array);

            Console.WriteLine("Expected: {0}", string.Join(", ", expected));
            Console.WriteLine("  Actual: {0}", string.Join(", ", array));
            CollectionAssert.AreEqual(expected, array);
        }