1,154 views

1 Answer

Best answer
2 votes
2 votes
If the range(0 - n) is given for the input numbers, then Counting sort can be useful in terms of Time complexity => O(n + k). and space complexity => O(k) if maximum key value is significantly smaller than the no. of inputs.

Otherwise, Heap sort would be the best one to use as Time Complexity => O(n*log(n)) and space complexity => O(1).
selected by

Related questions

8 votes
8 votes
2 answers
2
6 votes
6 votes
2 answers
4
radha gogia asked Jul 15, 2015
9,003 views
Assume that a CPU can process $10^8$ operations per second. Suppose you have to sort an array with $10^6$ elements. Which of the following is true? 1. Insertion sort will...