@raja Why? Any source to read why we can’t do that?
@kabir I think another case can be that counting sort deals with integers, but knapsack can deal with floating points, will this logic be true?
Yes you can say that but then someone can argue that we can use radix sort which can sort floating point numbers in linear time given we fulfill all the assumption of radix sort.
https://stackoverflow.com/questions/5149410/radix-sort-in-c-on-floating-points-numbers
So, it better to say that we don't want to assume anything about the input and use comparison based and use any type of number floating or integer in O(n) .
@tusharhigh