Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the problem of computing min-max in ... Start Learning for Free
Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?
  • a)
    a1 < a2
  • b)
    a1 > a2
  • c)
    a1 = a2
  • d)
    Depends on the input
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Consider the problem of computing min-max in an unsorted array where m...
When Divide and Conquer is used to find the minimum-maximum element in an array, Recurrence relation for the number of comparisons is 
T(n) = 2T(n/2) + 2 where 2 is for comparing the minimums as well the maximums of the left and right subarrays 
On solving, T(n) = 1.5n – 2. 
While doing linear scan, it would take 2*(n-1) comparisons in the worst case to find both minimum as well maximum in one pass.
Correct answer is (B)
View all questions of this test
Most Upvoted Answer
Consider the problem of computing min-max in an unsorted array where m...
Explanation:

Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Let the array be A[1…n]. The algorithm processes the array in a loop of size n/2 (for odd n, last element is ignored). In each iteration of loop, two elements are compared and the smaller element is compared with the current min value and the larger element is compared with the current max value. Therefore, the total number of comparisons in the worst case scenario is (3n/2)-2.

Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. The algorithm initializes the min and max values as the first element of the array. It then compares each element of the array with the current min and max values, updating them accordingly. Therefore, the total number of comparisons in the worst case scenario is 2(n-1).

Relation between a1 and a2:

In the worst case scenario, n is even and both algorithms have to process n/2 pairs of elements. Therefore, we can compare the number of comparisons required by both algorithms for a single pair of elements.

Algorithm A1 requires 3 comparisons (2 comparisons for comparison between two elements and 1 comparison for updating min and max values).

Algorithm A2 requires 2 comparisons (1 comparison for comparison between two elements and 1 comparison for updating min and max values).

Therefore, a1 = 3(n/2) and a2 = 2(n-1).

Now, we can compare a1 and a2 as follows:

a1/a2 = (3n/2)/(2n-2) = (3/2)/(2-(2/n))

As n approaches infinity, the denominator approaches 2 and the ratio approaches 3/4. Therefore, in the worst case scenario, a1 is approximately 3/4 times a2.

Answer:

The relation between a1 and a2 considering the worst case scenarios is a1 is approximately 3/4 times a2, which is option B.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer?
Question Description
Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the problem of computing min-max in an unsorted array where min and max are minimum and maximum elements of array. Algorithm A1 can compute min-max in a1 comparisons without divide and conquer. Algorithm A2 can compute min-max in a2 comparisons by scanning the array linearly. What could be the relation between a1 and a2 considering the worst case scenarios?a)a1 < a2b)a1 > a2c)a1 = a2d)Depends on the inputCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev