Discussion
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?
Answer: A
One comparison is enough: 1.
Pick any two elements and compare them. Since all elements are distinct, one is strictly smaller than the other, and the smaller one cannot be the largest element of the list. So it is an answer, found with a single comparison. Zero comparisons cannot work, because without comparing anything no element is known not to be the maximum.
N - 1 is the number of comparisons needed to find the largest element itself, which the question does not ask for. N and 2N - 1 are more than even that.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development