170 views

Which of the following is best running time to sort $n$ integers in the range $0$ to $n^2-1$?

1. $O(\text{lg } n)$
2. $O(n)$
3. $O(n\text { lg }n)$
4. $O(n^2)$

edited | 170 views
0
Best case of Insertion/Bubble sort (When Numbers are already sorted).

i.e O(n)
+1
can we sort in lgn time ?  at best it may be O(n)

Best time complexity is O(n).

https://www.geeksforgeeks.org/sort-n-numbers-range-0-n2-1-linear-time/

by (77 points)