public static void Sort(ref int[] arr, ref int steps) { for (var i = 0; i < arr.Length - 1; i++) { Heapifyer.HeapifyRange(ref arr, i, arr.Length - 1, ref steps); } }
public override void ReadInput(string input) { var steps = 0; if (input[0] == 'S') { var arr = ParseIntArray(input.Split(':')[1]); HeapSort.Sort(ref arr, ref steps); Output = string.Join(" ", arr) + $": {steps}"; } else { var arr = ParseIntArray(input); Heapifyer.Heapify(ref arr, ref steps); Output = string.Join(" ", arr) + $": {steps}"; } }