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
variables
openstack
tizen
relayjs
platform-builder
leon
packages
google-project-tango
opengl-es-2.0
flyway4
bs4
cross-validation
ups
mps
realex-payments-api
pingfederate
nhapi
delicious-api
sql-server-2012-express
yadcf
copying
uiswipegesturerecognizer
form-data
cloud-code
picasso
suricata
gesture
twitch
uft-api
angularjs-factory
dism
http-live-streaming
unixodbc
modelmapper
node-sass
errordocument
powercli
csound
tactic
python-cryptography
hittest
quartz-composer
sts-springsourcetoolsuite
jwplayer7
jms2
teamcity-8.0
thredds
cyclomatic-complexity
metaclass
python-3.2
qdialog
fouc
iis-arr
rgeo
varargs
deis
splash
composite
oberon
website-monitoring
oxwall
codeigniter-url
titanium-modules
navigationservice
elliptic-curve
doskey
android-2.2-froyo
meteor-velocity
jmapviewer
file-locking
excel-2003
buster.js
dataadapter
lcs
drools-planner
isnullorempty
nsnetservice
mercurial-server
xmemcached
locationlistener
oncheckedchanged
datareader
radcombobox
web-application-design
asp.net-profiles
microsoft-virtualization
thread-local-storage
mdac
multiple-languages

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