public void MaxHeapDoesNotInsertItemAsRootIfItemIsSmallerThanOriginalRoot()
        {
            int         testOrder      = 2;
            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };

            var maxDHeap = new MaxDHeap <int>(testOrder, testCollection.Randomize());

            int originalRoot = maxDHeap.Peek();

            maxDHeap.Insert(3);

            int newRoot = maxDHeap.Peek();

            Assert.AreEqual(51, originalRoot);
            Assert.AreEqual(51, newRoot);
        }
        public void MaxHeapsRootIsTheLargestValue()
        {
            int         testOrder      = 2;
            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };

            var maxDHeap = new MaxDHeap <int>(testOrder, testCollection.Randomize());

            int root = maxDHeap.Peek();

            Assert.AreEqual(51, root);
        }
        public void MaxHeapInsertsItemInCollectionAsRootIfItemIsLargerThanOriginalRoot()
        {
            int testOrder = 2;

            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };
            IList <int> newCollection = new List <int> {
                34, 36, 38, 40, 42, 44, 46, 48, 52
            };

            var maxDHeap = new MaxDHeap <int>(testOrder, testCollection.Randomize());

            int originalRoot = maxDHeap.Peek();

            maxDHeap.InsertRange(newCollection.Randomize());

            int newRoot = maxDHeap.Peek();

            Assert.AreEqual(51, originalRoot);
            Assert.AreEqual(52, newRoot);
        }
        public void MaxHeapMovesNextLargestValueToRootAfterRemoveRoot()
        {
            int         testOrder      = 2;
            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };

            var maxDHeap = new MaxDHeap <int>(testOrder, testCollection.Randomize());

            maxDHeap.RemoveRoot();

            int newRoot = maxDHeap.Peek();

            Assert.AreEqual(50, newRoot);
        }