He minimum number of comparisons required to find the minimum and the maximum of 100 numbers is __________
Answers
Answered by
2
Hi there !
Here's the answer:
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
• Initially first 2 element and compared.
-Note the current small and current large No.
• For the rest (n-2) elements, No.s are taken in pairs and compared.
- The smaller No. is compared with current small and if it is smaller then it(current small) is re-noted/updated
- Similarly, larger No. is compared with current large and if it is greater, then it(current large) is re-noted/updated.
• For every pair of No.s , we have 3 comparisions
Since, No. of Pair in (n-2) No.s = (n-2)/2
•°•
Total Comparisons =
Here, 1 is the first comparison made by taking first two No.s
NOW,
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
SOLUTION:
Given,
n = 100
Substitute n = 100 in the above formula
Total Comparisons needed =
=
= 147 + 1
= 148
•°• Total Comparisons needed to find minimum and maximum of 100 numbers = 148
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
Here's the answer:
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
• Initially first 2 element and compared.
-Note the current small and current large No.
• For the rest (n-2) elements, No.s are taken in pairs and compared.
- The smaller No. is compared with current small and if it is smaller then it(current small) is re-noted/updated
- Similarly, larger No. is compared with current large and if it is greater, then it(current large) is re-noted/updated.
• For every pair of No.s , we have 3 comparisions
Since, No. of Pair in (n-2) No.s = (n-2)/2
•°•
Total Comparisons =
Here, 1 is the first comparison made by taking first two No.s
NOW,
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
SOLUTION:
Given,
n = 100
Substitute n = 100 in the above formula
Total Comparisons needed =
=
= 147 + 1
= 148
•°• Total Comparisons needed to find minimum and maximum of 100 numbers = 148
•°•°•°•°•°<><><<><>><><>°•°•°•°•°
Answered by
0
the answer of this question is 148..
Similar questions