static void Main(string[] args) { int[] array = new int[10] { 1, 8, 9, 7, 6, 2, 0, 5, 3, 4 }; BinaryHeap heap = new BinaryHeap(); heap.Build(array); for (int i = array.Length - 1; i >= 0; i--) { array[i] = heap.GetMax(); Console.Write(String.Format("{0} ", array[i])); heap.Heapify(0); } Console.WriteLine("Press any key..."); Console.ReadKey(); }
public void Init() { _bh = new BinaryHeap(); }