The Gateway to Computer Science Excellence
+3 votes

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)$
in Algorithms by Veteran (424k points)
edited by | 170 views
Best case of Insertion/Bubble sort (When Numbers are already sorted).

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

1 Answer

0 votes

Best time complexity is O(n). 


Refer below link for reference



by (77 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,648 questions
56,429 answers
99,921 users