コード例 #1
0
        public void MinHeapRemoveRootReturnsSmallestValue()
        {
            int         testOrder      = 2;
            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };

            var minDHeap = new MinDHeap <int>(testOrder, testCollection.Randomize());

            int root = minDHeap.RemoveRoot();

            Assert.AreEqual(3, root);
        }
コード例 #2
0
        public void MinHeapMovesNextSmallestValueToRootAfterRemoveRoot()
        {
            int         testOrder      = 2;
            IList <int> testCollection = new List <int> {
                50, 51, 38, 37, 23, 11, 5, 3
            };

            var minDHeap = new MinDHeap <int>(testOrder, testCollection.Randomize());

            minDHeap.RemoveRoot();

            int newRoot = minDHeap.Peek();

            Assert.AreEqual(5, newRoot);
        }