Counting sort is an integer sorting algorithm for a collection of objects that sorts according to the keys of the objects.
Steps
Construct a working array C that has size equal to the range of the input array A.
Iterate through A, assigning C[x] based on the number of times x appeared in A.
Tr...
Constraints:
Input (an array to be sorted)
Number of element in input (n)
Keys in the range of 0..k-1 (k)
Count (an array of number)
Pseudocode:
for x in input:
count[key(x)] += 1
total = 0
for i in range(k):
oldCount = count[i]
count[i] = total
total += oldCount
for...
public class CountingSort
{
public static void SortCounting(int[] input, int min, int max)
{
var count = new int[max - min + 1];
var z = 0;
for (var i = 0; i < count.Length; i++)
count[i] = 0;
foreach (int i in input)
co...