Skip to content
Official PYQ · 2025

GATE CS 2025 Set 2 Q10 — Searching, Sorting, Hashing

Explain with AI

​​​​Consider an unorders list of NN distinct integers.

What is the minimum number of element comaparisons required to find an integer in the list that is NOT the largest in the list?

 

Choose one option
View worked solution

Answer: A

To find an element in an unordered list of NN distinct integers (N≥2N \ge 2) that is NOT the largest, we can use the following approach:

  1. Pick any two arbitrary elements from the list, say aa and bb.
  2. Compare them:
    • If a<ba < b, then aa cannot be the largest element in the list because bb is already larger than aa. Thus, aa is guaranteed to not be the largest.
    • If a>ba > b, then bb cannot be the largest element in the list because aa is already larger than bb. Thus, bb is guaranteed to not be the largest.

In either case, we identify an element that is definitely not the largest using exactly 11 comparison.

Therefore, the minimum number of element comparisons required is 11.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Searching, Sorting, Hashing questions