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
pdf
variables
debugging
reserved
maven-3
rdf
ravendb
here-api
spring-kafka
wheelnav.js
u-sql
collectd
alignment
commonmark
lombok
seaborn
tostring
pythonanywhere
oxyplot
viewport
scichart
excel-2007
bootstrap-tour
jndi
lcd
shopware
su
underflow
poltergeist
react-css-modules
compatibility
large-file-upload
windowbuilder
unboundid
r-raster
lightswitch-2013
stormpath
functor
scorm2004
webtest
azure-sql-database
appfabric
lto
android-browser
vapor
azure-ml
nand2tetris
vao
gpx
acoustics
wptoolkit
galleria
logfiles
flickr-api
azure-application-gateway
network-flow
prolog-setof
rails-routing
datastax-startup
nativeapplication
mako
flutterwave
hittest
dwscript
synchronous
background-service
google-cdn
messenger
static-ip-address
gridpane
android-textview
url-masking
mikroc
merge-conflict-resolution
paypal-express
player
firebaseui
nsviewcontroller
python-stackless
apachebench
revolution-r
energy
jfugue
sdhc
mutation-observers
atk4
php-ci
graph-drawing
lustre
tt-news
javafx-webengine
project-planning
uitouch
picturefill
stxxl
ivyde
ccss
dir
dexterity
ruby-datamapper
bulkloader
html-editor
quickdialog
qtkit
netbeans-6.9
semantic-diff
psi
actionview
iphone-web-app
imac
remember-me
google-friend-connect
asp.net-mvc-areas
coda-slider
revisions
brewmp
audio-capture
mtj
phonon
caching-application-block

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