0
Why count sort is not working?
I have created this code when i run it then it shows a error ..but its weird when i put code that is in count sort function into main function then erorr.. Here is the code: https://code.sololearn.com/cW6fW2btsXm6/?ref=app Please tell me why the code is not working...what the erorr really means and how to fix it
8 Respostas
+ 2
Line 8: int count[k+1] = {0};
+ 2
Martin Taylor Maybe Andrew is trying to implement something called `counting sort`.
https://www.geeksforgeeks.org/counting-sort/amp/
+ 2
Infinity thank you so much....
+ 2
Martin Taylor Yes, that's a major drawback of using any such algorithm bounded by memory. The reason why its still used might be the time complexity which is O(n+k). It can be useful if the input is well known in advance to be in a range below the number that doesn't blow up the stack, as you mentioned. Space or Time, there is always a trade-off.
+ 2
Andrew you're welcome
0
Infinity
Martin Taylor
Guys please have a look at this one I didn't got any answer that helps me please clear my doubts..
https://www.sololearn.com/Discuss/2804536/?ref=app