Exemple #1
0
        private static void Delete(MaxPriorityQueue priorityQueue)
        {
            int[]      nums = new int[] { 15, 13, 9, 5, 12 };
            Heap <int> heap = new Heap <int>(nums);

            priorityQueue.Delete(heap, 3);
            Console.WriteLine($"{string.Join(',', nums)} delete 3 is {string.Join(',', heap.GetHeap())}");
        }
Exemple #2
0
        private static void ExtractMax(MaxPriorityQueue priorityQueue)
        {
            int[]      nums = new int[] { 15, 13, 9, 5, 12, 8, 7, 4, 0, 6, 2, 1 };
            Heap <int> heap = new Heap <int>(nums);
            int        max  = priorityQueue.ExtractMax(heap);

            Console.WriteLine($"{string.Join(',', nums)} max is {max}, heap is {string.Join(',', heap.GetHeap())}");
        }