Question: Please help Im c++. Thank you Write a recursive solution to solve the Partition problem. Partition: Given a set A of n integers a1, az,...,
Write a recursive solution to solve the Partition problem. Partition: Given a set A of n integers a1, az,..., an, can you find a subset A of integers such that the sum of the integers in Ai is half of the sum of all the n integers (that is, eA1 al = aleAa0? Input: 1. Number of integers of set A: n 2. n integers: a, a, an Output: Print out yes if you can find a subset A1 of integers such that the sum of the integers in A is half of the sum of all the n integers (that is, LieA1 a.--anA . ai): otherwise, print out no Test your program with the following two instances: 1) 5 integers: 5, 10, 6, 8, 1 2) 20 integers: 1, 5, 7, 34, 76, 54, 23, 19, 22, 81, 44, 77, 29, 40, 11, 42,43, 31,57, 61
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
