pseudo code for counting sort is not there please provide it.
Counting Sort Algorithm
Hi @Vivek-Pandey-2129725577345937
Pseudo code for counting sort is as follows :
CountingSort(A)
//A[]-- Initial Array to Sort
//Complexity: O(k)
for i = 0 to k do
c[i] = 0
//Storing Count of each element
//Complexity: O(n)
for j = 0 to n do
c[A[j]] = c[A[j]] + 1
// Change C[i] such that it contains actual
//position of these elements in output array
////Complexity: O(k)
for i = 1 to k do
c[i] = c[i] + c[i-1]
//Build Output array from C[i]
//Complexity: O(n)
for j = n-1 downto 0 do
B[ c[A[j]]-1 ] = A[j]
c[A[j]] = c[A[j]] - 1
end func