Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago