Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this programming question, we will be considering the NUMBER PARTITION problem. As input, the number partition problem takes a sequence A = (a1, a2,

In this programming question, we will be considering the NUMBER PARTITION problem.

As input, the number partition problem takes a sequence A = (a1, a2, . . . an) of non-negative integers, and outputs a sequence S = (s1, s2, . . . sn) of signs si {1, +1} such that the residue

u=i=1nsiai

is minimized. Another way to view the problem is to split the set (or multi-set) of numbers given by A into two subsets A1 and A2 whose sums are as equal as possible. The absolute value of the difference of the sums is the residue.

(a.) NUMBER PARTITION can be solved exactly in time polynomial in n and B. Find and implement a dynamic programming algorithm that has worst-case running time that is a polynomial function of n and B. As always, justify correctness, formulate a DP recurrence and analyze the running time.

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_2

Step: 3

blur-text-image_3

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

Continuous Pseudometrics

Authors: W W Comfort ,S Negrepontis

1st Edition

0824762940, 978-0824762940

More Books

Students also viewed these Mathematics questions