edited by
2,055 views
0 votes
0 votes

Given an array where numbers are in range from 1 to n6 , which sorting algorithm can be
used to sort these number in linear time?
A. Not possible to sort in linear time
B: Counting Sort
C: Radix Sort
D. Quick Sort

edited by

1 Answer

2 votes
2 votes
Radix sort is correct answer

radix sort complexity =O(d(n+b))

now maximum no is $n^{6}$

so lets take base n  so digit in maximum no is $log_{n}(n^{6}-1) =6$

and base=n

so the complexity is O(6(n+n))=O(2n)=O(n)

Related questions

0 votes
0 votes
2 answers
2
_Madhuri asked Oct 9, 2021
648 views
The complexity of comparison based sorting algorithm is (nlogn) .How?
0 votes
0 votes
0 answers
3
1 votes
1 votes
2 answers
4
Ravi Dubey asked Aug 2, 2018
852 views
Could a binary search tree be built using o(n lg n) comparisons in the comparisonmodel? Explain why or why not.