public static void HeapSort(int[] array, bool inc) { PriorityQueue1 <int> hp = new PriorityQueue1 <int>(array, !inc); for (int i = 0; i < array.Length; i++) { array[array.Length - i - 1] = hp.Remove(); } }
public static void Main1(string[] args) { int[] a = { 1, 9, 6, 7, 8, 0, 2, 4, 5, 3 }; PriorityQueue1 <int> hp = new PriorityQueue1 <int>(a, true); hp.Print(); Console.WriteLine(); while (hp.IsEmpty() == false) { Console.Write(hp.Remove() + " "); } }