The minimum number of comparisons required to find the minimum and the maximum of 100

numbers is  ________

This question was previously asked in
GATE CS 2014 Official Paper: Shift 1
View all GATE CS Papers >

Answer (Detailed Solution Below) 148

Free
GATE CS Full Mock Test
65 Qs. 100 Marks 180 Mins

Detailed Solution

Download Solution PDF

Data:

n = 100

Formula:

minimum number of comparisons = 

Calculation:

minimum number of comparisons = 

Important Points:

Divide and conquer is used to achieve minimum comparison

Tournament Method Technique

1. To find the smallest element in the array will take n−1 comparisons = 100 – 1 = 99.

2. To find the largest element -

After the first round of Tournament, there will be exactly n/2 numbers = 50 that will lose the round.

So, the biggest looser (the largest number) should be among these 50 looser.

To find the largest number will take  comparisons = 49.

Total 99 + 49 = 148.

Latest GATE CS Updates

Last updated on Jan 8, 2025

-> GATE CS 2025 Admit Card has been released on 7th January 2025.

-> The exam will be conducted on 1st February 2025 in 2 shifts.

-> Candidates applying for the GATE CE must satisfy the GATE Eligibility Criteria.

-> The candidates should have BTech (Computer Science). Candidates preparing for the exam can refer to the GATE CS Important Questions to improve their preparation.

-> Candidates must check their performance with the help of the GATE CS mock tests and GATE CS previous year papers for the GATE 2025 Exam.

Hot Links: teen patti master purana teen patti gold download apk teen patti master 51 bonus