Question: 3. [10 marks] We now modify the problem in Question 2 slightly by not requiring i,j and k to be distinct. More precisely, the output
![3. [10 marks] We now modify the problem in Question 2](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4f9faf3e0e_81066f4f9fa5caa0.jpg)
3. [10 marks] We now modify the problem in Question 2 slightly by not requiring i,j and k to be distinct. More precisely, the output of the algorithm is'yes" if there exist three indices i, j and k, with 1-i, j, K-n, such that Ali] + AIj] + A t, and "no" otherwise For example, if AI1..7]-[28,-70,-23, 92, 56,-33,-77 and t--173, the answer would be "ves". because if we set i - 2 , 1-2, and k = 6, we have A[i1+ALj1+Akl 70-70-33 =-173 (a) [5 marks] Use the algorithm design paradigm of "reduce to known problem" to give an algorithm solution that uses (n2 lg n) time. (Hint: compute the following two sets of num bers: one set contains all possible values of A + A and the other set contains all possible values of t - A[k]) (b) [5 marks] Further give an O(n2)-time algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
