コード例 #1
0
ファイル: Program.cs プロジェクト: allanma88/SampleCode
        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())}");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: allanma88/SampleCode
        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())}");
        }