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
Answer: (B)
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.
Quiz of this Question
Recommended Posts:
- GATE | GATE 2017 MOCK II | Question 22
- GATE | GATE 2017 MOCK II | Question 2
- GATE | GATE 2017 MOCK II | Question 1
- GATE | GATE 2017 Mock | Question 65
- GATE | GATE 2017 Mock | Question 64
- GATE | GATE 2017 Mock | Question 63
- GATE | GATE MOCK 2017 | Question 61
- GATE | GATE MOCK 2017 | Question 60
- GATE | GATE MOCK 2017 | Question 59
- GATE | GATE MOCK 2017 | Question 58
- GATE | GATE MOCK 2017 | Question 57
- GATE | GATE MOCK 2017 | Question 56
- GATE | GATE MOCK 2017 | Question 55
- GATE | GATE MOCK 2017 | Question 54
- GATE | GATE MOCK 2017 | Question 53
- GATE | GATE MOCK 2017 | Question 52
- GATE | GATE MOCK 2017 | Question 51
- GATE | GATE 2017 MOCK II | Question 3
- GATE | GATE 2017 MOCK II | Question 4
- GATE | GATE 2017 MOCK II | Question 5

