Doubt in "counting sort"

while i submit the code it show run-error . My code is following :https://ide.codingblocks.com/s/110101

Rahul, you are using a little bit wrong approach,
You are taking a loop upto this point, but actually there is no need of it, you have to just perform the loop upto k, where k will be max element present in the original array.
for(int i=0;i<100005;i++)
Plz refer to online video lecture of counting sort for better understanding.

I am not understand how to find maximum element from the array?

int k=0;
for(int i=0;i<n;i++)
{
k=max(A[i],k);
}
Use these lines of code.