0

Let assume that ‘k’ is an integer that indicate and reveals exactly the length of subset that sum to 0. Thus length of subset to pick is determined by ‘k’. If I would like to pick only ‘k’ distinct set of integers from any given set of integers in polynomial time without having needed to check through every possible length other than the chosen length. What will be the time complexity and the size of the following examples?

Given a set of integers {-3, 17, 30, 12, -8 -15, 7, 45, 16, 9} is there a non-empty subset whose sum is zero? Yes, because k = 5. Output {-3, 17, -8, -15, 9 = 0} 
Given a set of integers {12, 5, -6, 7, -22} is there a non-empty subset whose sum is zero? No, because k = null. Output none
Given a set of integers {8, 20, 3, 35, -2, 3, 40, 7, 16, -9, 25} is there a non-empty subset whose sum is zero? Yes, because k = 4. Output {8, 3, -2, -9 = 0} 
Given a set of integers {-2, 10, 15, 20, 3, 12, 45, -6, 17, 1, 18, 5} is there a non-empty subset whose sum is zero? Yes because k = 9. Output {-2, 15, 3, 12, -45, -6, 17, 1, 5 = 0} 

Edited by claptus

2
Contributors
1
Reply
11
Views
1 Year
Discussion Span
Last Post by Reverend Jim
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.