Witam mam problem z programem który sortuje przez kopcowanie dowolna tablicę liczb i mierzy czas sortowanie problem jest z wyświetleniem pomoże ktoś ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Random Generator;
string Zmienna;
int[] T;
int i, j, k, x, Ileliczb;
DateTime Start;
DateTime Stop;
TimeSpan Interwał;
long CzasObliczeń;
/* Wypełnienie Tablicy */
Generator = new Random();
Console.WriteLine("Podaj liczbę elementów tablicy:");
Zmienna = Console.ReadLine();
Ileliczb = Int32.Parse(Zmienna);
T = new int[Ileliczb];
for (i = 0; i < T.Length; i++)
{
T[i] = Generator.Next(100);
}
/* Budowa kopca + obliczanie czasu sortowania */
CzasObliczeń = 0;
Start = DateTime.Now;
for (i = 2; i <= T.Length; i++)
{
j = i; k = j / 2;
x = T.Length;
while ((k > 0) && (T[k] < x))
{
T[j] = T[k];
j = k; k = j / 2;
}
T[j] = x;
}
x = (T.Length + 1) / 2; k = 2;
for (i = 1; i <= T.Length; i++)
{
for (j = 1; j <= x - 1; j++) Console.Write(" ");
Console.Write(T[i]);
for (j = 1; j <= x; j++) Console.Write(" ");
if (i + 1 == k)
{
k += k; x /= 2; Console.WriteLine();
}
}
Stop = DateTime.Now;
Interwał = Stop - Start;
CzasObliczeń = Interwał.Ticks;
Console.WriteLine(" --------------------------------");
Console.WriteLine("Czas obliczeń " + " --->" + CzasObliczeń);
Console.ReadLine();
}
}
}