Question Details

Consider an unordered list of N distinct integers. What is the minimum num ber of element comparisons required to find an integer in the list that is NOT the largest in the list?

Options

A

1

B

N 1

C

N

D

2N– 1

Show Answer

Correct Answer :

Option A

1

Solution :

The correct option is 1.

To understand why this is the correct answer, let us break down the logical reasoning step-by-step:
We are given an unordered list containing N distinct integers. We assume N2 so that there is at least one element that is not the largest.
Since all the integers in the list are distinct, there is exactly one unique largest integer in the entire list. The remaining N-1 integers in the list are strictly smaller than this maximum value, meaning any of them is "NOT the largest".

Now, let us select any two arbitrary elements from the list, say A and B .
If we perform a single comparison between these two elements, we will find one of the following:
1. If A<B , then A is strictly smaller than B . Because B is greater than A , A cannot possibly be the largest element in the entire list.
2. If A>B , then B is strictly smaller than A . Because A is greater than B , B cannot possibly be the largest element in the entire list.

In either case, a single comparison between any two elements allows us to immediately identify one element (the smaller of the two) that is guaranteed not to be the largest element in the list. Therefore, the minimum number of element comparisons required is exactly 1.

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Discover more resources

You may also like

Mock Tests

View All
  • GATE
  • beginner
  • 3 hours
  • computer science and information technology

  • GATE
  • intermediate
  • 3 hours
  • computer science and information technology

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...