Good evenning.I'll try to make myself understood, I'm from Argentina and my English is bad. I want to make a list of 50 items (checkbox), each element has a value from 1 to 10. I selected 10 items from the list of 50 and push a button.By pressing this button, I want the program to divide the 10 items selected into 2 groups, without repeating the elements. The condition is that these groups, the sum of approximately similar. By showing the two groups in each separate elements.Example.I want solomanete names are involved, the number want to remain hidden from the user's view. apple 10 pear 8 peach 9 watermelon 5 lemon 7 Grapefruit 3 strawberry 8 Tangerine 4 plum 4 Grape 7 kiwi 9 banana 7 anana 7 ... More items. When I select 10 items from the list, press a button "calculate"Result, I want to show me the items in their groups, and the result of the sum. group a: apple, tangerine, plum, pineapple, peach. 34 (10 + 4 + 4 + 7 + 9 = 34) Group B: grapefruit, lemon, strawberry, banana, kiwi. 34 (3 + 7 + 8 + 7 + 9 = 34) I do not want to just like always, but always it About BPD at most similar between groups. I hope you understand what I want to achieve do. Thank You.
Well... you'll have different elements with different values, and you want to divide them into two groups (on a user-submit). That much is clear. However, how is it you want to divide them? So that each group has as close values as possible (ie, within a given range, or just as close as possible)? Do the groups have to have the same amount of members? Ie, can it be 4 in one and 6 in another? Or should it always be 5 and 5? I don't really think this is too hard to do, but it would involve some math
The idea is to always choose 10 items from the list, and always separated by 5 and 5 and the sum of group.1 similar to that of grupo.2. group.1 - grupo.2 = almost 0, range -5 to 5.
Well... if you have 50 items, you have 5 each of the values 1 to 10 - which means that your requirement isn't really possible to manage. The reason I say this is as follows: Let's say you have the following 10 items: 1,1,1,1,3,10,10,10,4,2 You have to split these into 5 and 5 1 1 3 10 2 - 17 1 1 4 10 10 - 26 That would make a 9 value difference - and it's not possible to "fix it" with the requirements you set. So... you either have to lighten up on the max difference (the max difference is 9) or do something else with the data.