Question: (Minimum positive-sum subarray) (40 points) In this variation of the Maximum- Sum Subarray Problem, you are given a one-dimensional array A[1 : n] of positive

(Minimum positive-sum subarray) (40 points) In this variation of the Maximum- Sum Subarray Problem, you are given a one-dimensional array A[1 : n] of positive and negative numbers, and you are asked to find a subarray Afi :j] such that the sum of its elements is (1) strictly greater than zero, and (2) minimum. In other words, you want to find a subarray of smallest positive sum. (a) (40 points) Using divide-and-conquer, design an algorithm that runs in O(n log" n) time (Hint: Recall that n numbers can be sorted in O(n log n) worst-case time. You may also need to know that the recurrence T(n)2T(n/2) + O(n log n) has the solution T(n) O(n log2 n).)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
