What is the average time complexity of counting sort?
A) O(n)
B) O(n+k) k=range of input
C) O(n^2)
D) O(n log n)
Answers
Answered by
0
Answer:O(n+k)
Explanation: Time complexity of counting sort is O(n+k) as counting the occurrence of each element in the input range takes k time and then finding the correct index value of each element in the sorted array takes n time.
Similar questions