Computer Sciences > GATE 2025 SET-2 > Comparison-Based Sorting
Consider an unordered list of N distinct integers.
What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?
A
1
B
N-1
C
N
D
2N-1

Correct : a

The correct answer is Option A - 1.
This is a beautifully simple question once you see the trick. We need to find any element that is not the largest - we don''t need to find the maximum or sort anything.
Here''s all you need to do: pick any two elements from the list and compare them. Since all integers are distinct, one will be strictly smaller than the other. That smaller element is guaranteed to not be the largest in the entire list - because the element it was just compared to is already larger than it.
So with just 1 comparison, we''ve identified an element that is not the largest.
Options B (N-1), C (N), and D (2N-1) would all be answers if we were trying to find the maximum element. But since we only need any non-largest element, a single comparison is all it takes.

Similar Questions

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ
Choose the word that is opposite in meaning to the word “coherent”.
#5 MCQ

Related Topics

minimum comparisons non-largest GATE 2025 GATE CS 2025 Set-2 Q20 find non-largest element one comparison non-maximum algorithms GATE comparison based algorithm distinct integers list GATE GATE computer science algorithms 2025 minimum comparisons MCQ GATE

Unique Visitor Count

Total Unique Visitors

Loading......