Question: We are given an array that contains N numbers. We want to determine if the are the numbers whose sum equals a given number K

We are given an array that contains N numbers. We want to determine if the are the numbers whose sum equals a given number K. For instance, if the input is B,4,1,6 ant Kis 10, then the answer is yes (4 and 6) A number may be used hwice.
Select one or more.
O a, If the elements are fist sorted with quicksor, then the total cast of the sohn
algorithm is ON log N
b. I the elements are first sorted with heapsor, then the total cost af the soling algorithm is O/N log N)
O If the elements are already presorted then the cost of the seact algarithm is O DId. A brute-force search algoritim costs ON%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!