Ejemplo n.º 1
0
        public void RemoveAt_RemoveLastItem_RemoveSuccessful()
        {
            int[] input    = this.sampleMaxHeap;
            int[] expected = { 100, 19, 36, 17, 3, 25, 1, 2 };

            MaxHeap <int> heap = this.CreateMaxHeapFromArray(input);

            heap.RemoveAt(input.Length - 1);

            Assert.IsTrue(heap.GetItems().SequenceEqual(expected));
        }
Ejemplo n.º 2
0
        public void RemoveAt_RemoveRootItem_RemoveSuccessful()
        {
            int[] input    = this.sampleMaxHeap;
            int[] expected = { 36, 19, 25, 17, 3, 7, 1, 2 };

            MaxHeap <int> heap = this.CreateMaxHeapFromArray(input);

            heap.Pop();

            Assert.IsTrue(heap.GetItems().SequenceEqual(expected));
        }