in Algorithms retagged by
479 views
0 votes
0 votes
Given an Unsorted array, Find maximum in less than O(n) time?

How can we do this?
in Algorithms retagged by
479 views

4 Comments

$\Theta(n)$ also implies that $\Omega(n)$ holds, @Swapnil Naik

0
0

Yes, but Θ(n) would be more appropriate for a given condition.

0
0
Bubble Sort won't be right because it will take at least O(n) time right? Am I doing anything wrong here?
0
0

1 Answer

0 votes
0 votes

I think a simple looping through the array once is enough

 FindMax( A[] ):
   max=A[0]
   for i in A:
     if(i>max):
       max=i
   return max

 

Related questions

0 votes
0 votes
0 answers
3
Deepalitrapti asked in Algorithms Sep 1, 2018
851 views
Deepalitrapti asked in Algorithms Sep 1, 2018
851 views