static void Sort(int[] array)
int length = array.Length;
int[] output = new int[length];
int[] count = new int[100];
for (int i = 0; i < 100; ++i)
for (int i = 0; i < length; ++i)
for (int i = 1; i <= 99; ++i)
count[i] += count[i - 1];
for (int i = length - 1; i >= 0; i--)
output[count[array[i]] - 1] = array[i];
for (int i = 0; i < length; ++i)
public static void Main()
int[] array = { 64, 11, 83, 8, 13, 45, 92, 98, 55, 17, 41, 81, 11, 64, 14, 41, 11, 92 };
Console.WriteLine("Counting Sort");
CommonFunctions.PrintInitial(array);
CommonFunctions.PrintFinal(array);