Problem is you are given n number of weights, we need to distribute it in both the hands so that weight difference between hand is minimum.
Eg. Weights Given : 5 8 4
Good Distribution -
Right Hand : 5 4
Left Hand : 8
Thanks in advance.
Problem is you are given n number of weights, we need to distribute it in both the hands so that weight difference between hand is minimum.
Eg. Weights Given : 5 8 4
Good Distribution -
Right Hand : 5 4
Left Hand : 8
Thanks in advance.
Here is a simple strightforward algorithm to get you started.
Loop until all weights placed
Place heaviest unplaced weight in left hand
Loop until right hand weights > left hand weights
Place heaviest unplaced weight less than difference in weights in hands in right hand