in Algorithms retagged by
382 views
0 votes
0 votes

An unordered list contains $n$ distinct elements. The number of comparisons to find an element in the list that is larger than the second minimum in the list is

  1. $\Theta(n \log n)$
  2. $\Theta(n/ \log n)$
  3. $\Theta(1)$
  4. $\Theta(\log n)$
in Algorithms retagged by
by
382 views

1 Answer

1 vote
1 vote
I think just 3 comparisons are needed among 1st, 3 elements of the array. the elements greater in this 1st, 3 elements will definitely be greater than the 2nd minimum element.

Hence T(n)  = O(1)

2 Comments

but how we will find 2nd minimum of list?
0
0

It’s telling that just largest of 2nd minimum means any number greater than 2nd minimum you chose any three number to compare them and find largest number in 2 comparsions because list order or unordered.

ex unorder list = 4,5,6,2,1,3

           let we pick randomly 3 no of list     4,5,6  comparisons finding largest of 2nd is 2 and number is 6

0
0
Answer:

Related questions