示例#1
0
        private static void TestBinaryMaxHeap()
        {
            BinaryMaxHeap <String> heap = new BinaryMaxHeap <String>();

            heap.AddNode(3, "Tushar");
            heap.AddNode(4, "Ani");
            heap.AddNode(8, "Vijay");
            heap.AddNode(10, "Pramila");
            heap.AddNode(5, "Roy");
            heap.AddNode(6, "NTF");
            heap.PrintHeap();



            var node = heap.extractMax();

            while (node != null)
            {
                Console.WriteLine("Max Node extracted is :" + node.Data + " " + node.Weight);
                heap.PrintHeap();

                node = heap.extractMax();
            }
        }