Let $A$ be an array of $n$ elements consisting of only $-1,1,0$. What is the least number of comparisons that must be made in worst case to sort the array?
At first I was thinking of the answer is 0 because this can be solved easily with count sort without using any direct comparison between elements. But I think the problem wants to use a Comparison-based sorting algorithm. I don't know what should I do to specifically sort array of three numbers in least comparisons.
I think you can do this in $O(n)$. Something like walking through the numbers, counting the number of each element. Then just print out, in order, the appropriate number of $-1$, $0$, and $1$s. Perhaps it depends on how strictly they interpret 'comparison,' but arguably that would take 0 comparisons.
Hmm, I still think $O(n)$. If you use insertion sort, and can simply place all encountered $-1$ at one end of a queue and all $1$ at the other end, at worst that'd be $n$ too. Again, depends on 'comparison' though, though it's fair to say you'd be comparing each element one at a time against $0$.