using System.Diagnostics;
public static int[] ImputArray(int size)
int[] result = new int[size];
for(int i = 0; i < size; i++)
Console.Write("Imput a number: ");
result[i] = int.Parse(Console.ReadLine());
public static int[] RandomArray(int size)
int[] result = new int[size];
Random rand = new Random();
for(int i = 0; i < size; i++)
result[i] = rand.Next(3*size);
public static void PrintArray(int[] array)
for(int i = 0;i < array.Length; i++)
Console.Write("{0} ", array[i]);
public static void Swap(ref int x, ref int y)
public static void BubbleSort(int[] array)
for(int i = 0; i < n-1; i++)
for(int j = n-1; j >i ; j--)
if(array[j] < array[j-1])
Swap(ref array[j],ref array[j-1]);
public static void StraightSort(int[] array)
for(int i = 0; i < n-1; i++)
int min = array[i], k =i;
for(int j = i+1; j < n; j++)
Swap(ref array[i],ref array[k]);
public static void Main()
int[] array = RandomArray(N);
Stopwatch stw = new Stopwatch();
Console.WriteLine("Milisec {0} " ,stw.ElapsedMilliseconds);