5. Consider the following problem: {a₁, a2,. an} of positive integers, and an "size" s(a) for each a € A. Question: Is there a subset A' CA such that the sum of the sizes of elements in A' is equal to the sum of the sizes of elements in A - A'? Or in other words, is there is subset A' of A such that the sum of the sizes of elements in A' is half of the total sum of sizes of elements in A? Input: A finite set A = ...9 Examples: For A = {a₁, a2, a3, a4, a5}, s(a₁) = 1, s(a₂) = 9, s(a3) 9, s(a3) = 5, s(a₂) + s(a4) = 26/2 = s(a3) + s(a5). = 5, s(a4) = 3, s(as) s(a5) = 8, the answer is YES because s(a1) + s(a4) = 3, For A = {a1, a2, A3, A4, A5}, s(α₁) = 1, s(a2) = 9, s(a3) = 5, s(a4) = 3, s(a5) = 7, the answer is immediately NO because the sum of size is 25, which is not divisible by 2, so no A' exists. Let us denote by B the sum of sizes of elements of A and assume it is even. For 1 ≤ i ≤ n and 0 ≤ j ≤ B/2, let t(i, j) be the truth value of the statement: "there is a subset of {a₁, a2, ... a;} for which the sum of the sizes of elements is exactly j". (d) Consider a dynamic programming solution using the recurrence above, where you build a table to hold your partial solutions. The rows of the table correspond to i, and columns correspond to j. How many cells does this table have? (e) What is the running time of the dynamic programming algorithm? (f) Is this a polynomial-time algorithm?

Oh no! Our experts couldn't answer your question.

Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.

Submit your question and receive a step-by-step explanation from our experts in as fast as 30 minutes.
You have no more questions left.
Message from our expert:
Our experts need more information to provide you with a solution. need more details Please resubmit your question, making sure it's detailed and complete. We've credited a question to your account.
Your Question:

Dynamic Programming Exercise Problem

5. Consider the following problem:
{a₁, a2,.
an} of positive integers, and an "size" s(a) for each a € A.
Question: Is there a subset A' CA such that the sum of the sizes of elements in A' is equal to the sum of the sizes of
elements in A - A'? Or in other words, is there is subset A' of A such that the sum of the sizes of elements in A' is half of
the total sum of sizes of elements in A?
Input: A finite set A
=
...9
Examples:
For A = {a₁, a2, a3, a4, a5}, s(a₁) = 1, s(a₂) = 9, s(a3)
9, s(a3) = 5,
s(a₂) + s(a4) = 26/2 = s(a3) + s(a5).
= 5, s(a4) =
3, s(as)
s(a5) = 8, the answer is YES because s(a1) +
s(a4) = 3,
For A = {a1, a2, A3, A4, A5}, s(α₁) = 1, s(a2) = 9, s(a3) = 5, s(a4) = 3, s(a5) = 7, the answer is immediately NO because
the sum of size is 25, which is not divisible by 2, so no A' exists.
Let us denote by B the sum of sizes of elements of A and assume it is even. For 1 ≤ i ≤ n and 0 ≤ j ≤ B/2, let t(i, j) be
the truth value of the statement: "there is a subset of {a₁, a2, ... a;} for which the sum of the sizes of elements is exactly
j".
(d) Consider a dynamic programming solution using the recurrence above, where you build a table to hold your partial
solutions. The rows of the table correspond to i, and columns correspond to j. How many cells does this table have?
(e) What is the running time of the dynamic programming algorithm?
(f) Is this a polynomial-time algorithm?
Transcribed Image Text:5. Consider the following problem: {a₁, a2,. an} of positive integers, and an "size" s(a) for each a € A. Question: Is there a subset A' CA such that the sum of the sizes of elements in A' is equal to the sum of the sizes of elements in A - A'? Or in other words, is there is subset A' of A such that the sum of the sizes of elements in A' is half of the total sum of sizes of elements in A? Input: A finite set A = ...9 Examples: For A = {a₁, a2, a3, a4, a5}, s(a₁) = 1, s(a₂) = 9, s(a3) 9, s(a3) = 5, s(a₂) + s(a4) = 26/2 = s(a3) + s(a5). = 5, s(a4) = 3, s(as) s(a5) = 8, the answer is YES because s(a1) + s(a4) = 3, For A = {a1, a2, A3, A4, A5}, s(α₁) = 1, s(a2) = 9, s(a3) = 5, s(a4) = 3, s(a5) = 7, the answer is immediately NO because the sum of size is 25, which is not divisible by 2, so no A' exists. Let us denote by B the sum of sizes of elements of A and assume it is even. For 1 ≤ i ≤ n and 0 ≤ j ≤ B/2, let t(i, j) be the truth value of the statement: "there is a subset of {a₁, a2, ... a;} for which the sum of the sizes of elements is exactly j". (d) Consider a dynamic programming solution using the recurrence above, where you build a table to hold your partial solutions. The rows of the table correspond to i, and columns correspond to j. How many cells does this table have? (e) What is the running time of the dynamic programming algorithm? (f) Is this a polynomial-time algorithm?
Knowledge Booster
Recurrence Relation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole