Question: 32. You are given an array A of n distinct integers (in not arranged in any particular order. The objective is t and the second


32. You are given an array A of n distinct integers (in not arranged in any particular order. The objective is t and the second largest of these integers if ra 2. For the sake of simplicity, you can nssume that Warning: Don't sort the whole array. dexed t I through n) which are o determine the Iurgest n integers. Observe that the problem in trivial of two. n is a power (a) Develop an algorithm based on the divide and conquer principle to do so. Present your idea in the form of a pseudocode. Provide brief explanation in English as well. (4 Pts.) of your algorithm. State both the recurrence relation and the base condi- tion for it. Assume that the comparison of two integers from the array is the only time consuming operation. Time spent doing anything else can be ignored. (3 Pts.) (b) Develop a recurrence relation for the running time (worst case complexity)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
