Esempio n. 1
0
        public void MaxHeapTest()
        {
            List <int> arr = new List <int>()
            {
                1, 55, 4, 5, 11, 3, 21
            };

            HeapSort maxHeap = new HeapSort(arr);
            var      result  = maxHeap.BuildMaxHeap();

            Assert.AreEqual(result[0], 55);
        }
Esempio n. 2
0
        public void MaxHeapTest1()
        {
            List <int> arr = new List <int>()
            {
                1, 24, 4, 54, 55
            };

            HeapSort maxHeap = new HeapSort(arr);
            var      result  = maxHeap.BuildMaxHeap();

            Assert.AreEqual(55, result[0]);
        }
 public void TestMethodBuildMaxHeap()
 {
     int[] nums = { 27, 16, 3, 16, 13, 10, 1, 5, 7, 12, 4, 8, 9, 0 };
     HeapSort.BuildMaxHeap(nums);
     CollectionAssert.AreEqual(nums, new int[] { 27, 16, 10, 16, 13, 9, 1, 5, 7, 12, 4, 8, 3, 0 });
 }