in Algorithms edited by
3,925 views
0 votes
0 votes

Which of the following algorithms sort $n$ integers, having the range $0$ to $(n^2 -1)$, in ascending order in $O(n)$ time?

  1. Selection sort
  2. Bubble sort
  3. Radix sort
  4. Insertion sort
in Algorithms edited by
3.9k views

1 comment

Only Radix sort among options can sort in linear time i.e O(n)  rest are comparison sorts

so ans is C
1
1

4 Answers

0 votes
0 votes
Best answer
ans c except radix sort all given algorithms take O(n^2) time so ans is radix sort it performs sorting digit by digits taking O(n) time
selected by
0 votes
0 votes

Radix sort take O(N) time .

2 Comments

how??? can u  explain..
0
0
Radix sort run loop = Max no. of digits in one Number and Number of digit is constant [can't be n].

so loop run n times only.
0
0
0 votes
0 votes
Selection sort takes O(n2) time.
Bubble sort takes O(n2) time.
Radix sort takes O(n) time.
Insertion sort takes O(n2) time.

So, option (C) is correct.
0 votes
0 votes
Answer:

Related questions