retagged by
1,043 views
1 votes
1 votes
Consider an array of 19 elements, Find the minimum number of comparisons required to find minimum and maximum elements in an array
retagged by

3 Answers

Best answer
3 votes
3 votes

is anythng i miss?

selected by
0 votes
0 votes
Minimum number of comparison is O(1) ,when we know array is sorted.

But here we donot know array as sorted

So, minimum no. comparison and maximum number of comparison=O(n)=3/2n-2 comparisons

For 19 element , in worst case it will be (3/2*19-2) comparison.
edited by
0 votes
0 votes
We have to do (n-1) comparison , so for 19 elements total comparison requires is 18.

Related questions

5 votes
5 votes
1 answer
1
shaurya vardhan asked Nov 4, 2017
8,156 views
You are given an array of 64 elements, minimum number of comparisons required to find out second largest element among all will be _______.
50 votes
50 votes
3 answers
3
Kathleen asked Sep 12, 2014
8,769 views
The minimum number of comparisons required to sort $5$ elements is ______
3 votes
3 votes
1 answer
4
Rohan Mundhey asked Nov 9, 2016
2,173 views
Consider an array contains 2k distinct elements. How many comparisons are needed to find the smallest and the second smallest elements in the given array? 2k comparisons ...