public static void HeapSort(int[] array, Tree tree) { int[] tempArray = new int[array.Length]; for (int i = array.Length - 1; i >= 0; i--) { tempArray[i] = tree.PopFromHeap(); } for (int i = 0; i < array.Length; i++) { array[i] = tempArray[i]; } }