Question: Consider the following problem. Given a list of n(n even) distinct positive integers, partition the list into two sub-lists, each of size n/2, such that

Consider the following problem. Given a list of n(n even) distinct positive integers, partition the list into two sub-lists, each of size n/2, such that the difference between the sums of the integers in the two sublists is MINIMIZED. State your algorithm in no more than 4 simple sentences. do not write a pseudocode. What is the O complexity ? Here is the answer if it was MAXIMIZED: 1) find median 2) compare each element in the set with median 3) if element > median put it in set1 || if element < median put it in set2. 4) compute the sum of elements in s1 and s2: answer is A-B (Complexity os O(n)

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 Databases Questions!