Question: ( 2 points ) ( a ) ( 2 marks ) Shinigami took Light Yagami's special notebook and issued a challenge. To get it back,

(2 points)(a)(2 marks) Shinigami took Light Yagami's special notebook and issued
a challenge. To get it back, Light needs to solve the "Min Max" problem. Light's
task: Given an array of 'N' integers, determine the maximum values obtained by
taking the minimum element over all possible subarrays of varying sizes from 1 to
'N'.
(b)(Bonus 3 marks) Help Light Yagami to solve this problem in O(n) time.
Consider an array, Arr=[3,1,2,4].
For subarrays of size 1: max(min(3),min(1),min(2),min(4))=4
For subarrays of size 2:max(min(3,1),min(1,2),min(2,4))=2
For subarrays of size 3:max(min(3,1,2),min(1,2,4))=1
For subarrays of size 4:max(min(3,1,2,4))=1
The resulting array is 4,2,1,1.
 (2 points)(a)(2 marks) Shinigami took Light Yagami's special notebook and issued

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!