Question: 4. We are given a set S containing n real numbers and a real number x. (a) (10 points) Design an O(nlogn) time algorithm to

4. We are given a set S containing n real numbers and a real number x. (a) (10 points) Design an O(nlogn) time algorithm to determine whether there exist two elements in S whose sum is exactly x. (b) (10 points) Suppose the set S is given in a sorted order. Design an O(n) time algorithm to solve this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
