Question: 3 marks : We are given an array that contains N numbers. We want to determine if there are two numbers whose sum equals a
marks : We are given an array that contains N numbers. We want to determine if there are two numbers whosesum equals a given number K For instance, if the input is and K is then the answer is yes and A number may be used twice. Do the following:
Give an ON algorithm to solve this problem.
Give an ON logN algorithm to solve this problem. Hint: Sort the items first. After that is done,you can solve the problem in linear time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
