Which of the following sorting techniques is most efficient if the range of input data is not significantly greater than a number of elements

Ngô Quốc Huy

New member
Which of the following sorting techniques is most efficient if the range of input data is not significantly greater than a number of elements to be sorted?
A. selection sort
B. bubble sort
C. counting sort
D. insertion sort
 
Answer: c
Explanation: Time complexity of counting sort is given as O(n+k) where n is the number of input elements and k is the range of input. So if range of input is not significantly larger than number of elements in the array then it proves to be very efficient.
 

Tìm kiếm

Back
Top