subset-sum


Clarification on subset sum


This is programming project for a class of mine, I'm not looking for an answer but more of an explanation of the problem. I don't really understand what is being asked..
Here is another input/ output:
input:
1 2 3 3 4 5
output:
1 2 3 3
I don't understand how we are getting this output, can someone explain it to me simpler? Thanks
If the input is 1 2 3 3 4 5, the subsequences are:
1
1 2
1 2 3
1 2 3 3
1 2 3 3 4
1 2 3 3 4 5
2
2 3
2 3 3
...
Over all the subsequences, 1 2 3 3 is such that |(1 + 2 + 3 + 3) - (4 + 5)| = 0 is minimal.
If we take the subsequence 2 3 3, we have |(2 + 3 + 3) - (1 + 4 + 5)| = |8 - 10| = 2 which is greater.
However, I'm also confused by the meaning of "subsequence". I thought that, the subsequences of 1 2 3 4 5 should be:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
2
2 3
2 3 4
2 3 4 5
3
3 4
3 4 5
4
4 5
5
But according to the subject, the optimal subsequence is 1 2 4 which is not in my list. It's in fact a subset of the set S. So be careful, there are many combinations.

Related Links

Subset sum with dynamic programming
Reducing Subset Sum Problm
Clarification on subset sum
Subset whose sum is the smallest sum over a specific threshold

Categories

HOME
listview
gerrit
openmp
react-redux
microservices
cakephp-2.5
ojdbc
uber-api
dacpac
tomcat6
node-pdfkit
visual-studio-2005
quickfix
serverless-framework
serilog
reactive-cocoa
text-rendering
karma-jasmine
swingx
swiftlint
amazonsellercentral
java-3d
scriptcs
jquery-ajaxq
tokenize
fifo
neo4j-spatial
ejabberd-module
primitive
nameservers
binary-data
titanium-mobile
karaf
webtest
http-referer
simplexml
occlusion
xenforo
uft-api
elasticsearch-plugin
avro4s
sql-server-agent
isbn
http-redirect
total-commander
wptoolkit
jedis
errordocument
jquery-validate
python-webbrowser
carrot
sqlclient
feeds
memory-alignment
gcsfuse
messenger
root-framework
savon
intrusion-detection
essence
independentsoft
unity-networking
collapse
method-parameters
inmobi
npapi
gwidgets
c3
issuu
neolane
bitcoinj
google-reader
hyprlinkr
cloud-connect
mcts
terminal-services
farseer
sitemesh
odata4j
buster.js
rabl
sqlperformance
wsdl-2.0
kyotocabinet
itmstransporter
pvrtc
dmoz
frameset
labwindows
chrono
buildr
coredump
f#-powerpack
horizontal-accordion
cxxtest
subviews
getresponsestream
user-friendly
photoshop-cs4
pascal-fc
post-build
msdev

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App