Computer Science, asked by minakshikoul7, 8 months ago

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 al 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 al
and a2 considering the worst case scenarios?​

Answers

Answered by sanatarajan55
0

Answer:

a1 > a2

Explanation:

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.

pls mark as brilliant answer

Similar questions