Exemplo n.º 1
0
        static void TestRemove()
        {
            MyHeap <int> heap = new MyHeap <int>();

            heap.Add(10); Console.WriteLine("Adding 10 to the heap...");
            heap.Add(21); Console.WriteLine("Adding 21 to the heap...");
            heap.Add(1); Console.WriteLine("Adding 1 to the heap...");
            heap.Add(33); Console.WriteLine("Adding 33 to the heap...");
            heap.Add(13); Console.WriteLine("Adding 13 to the heap...");
            heap.Add(55); Console.WriteLine("Adding 55 to the heap...");
            heap.Add(2); Console.WriteLine("Adding 2 to the heap...");
            heap.Add(0); Console.WriteLine("Adding 0 to the heap...");
            heap.Add(77); Console.WriteLine("Adding 77 to the heap...");
            heap.Add(67); Console.WriteLine("Adding 67 to the heap...");
            heap.Add(22); Console.WriteLine("Adding 22 to the heap...");

            Console.WriteLine(heap.ToString());
            heap.Remove(13);
            Console.WriteLine(heap.ToString());
        }