1. ## End of BruteForce.java?

i've finished bruteforce.java. it can go up more than 20# now. I've also added a checker, so if difference of groups is == 0, then break out of loop. First I ran it on 20C10. w/o the checker, its 23sec. w/ the checker, its 11secs. So then i calculated that it checks about 7-8 combos per milisec on a 1ghz cpu (w/o checker). that's 8000 combo per sec. That means... for 100C50...

Java Code:
```100C50
[B]combos: 100891344545564193334812497256[/B]
(it takes:)
sec:    12611418068195524166851562
hours:  3503171685609867824125
days:   145965486900411159338
week:   20852212414344451334
month:  5213053103586112833
year:   434421091965509402
cent:   4344210919655094```
Last edited by angryboy; 02-15-2009 at 05:33 AM.

2. Member
Join Date
Jan 2009
Posts
40
Rep Power
0
hmmm sounds like this forum could be around for a couple of years before we actually figure out an answer to that 100C50 hehe

3. couple of years? doesn't this mean centuries?
cent: 4344210919655094
that means 434421091965509.4 millenia...
Exactly what does the numberCnumber mean?
how could it take that long?
Last edited by MK12; 02-16-2009 at 06:45 PM.

4. Member
Join Date
Jan 2009
Posts
40
Rep Power
0
sorry, sarcasm is hard to understand on the forums but i'm sure angryboy understood what i meant... a couple of years was intended to be a HAHA, good luck...

5. Oh ok. but what does the 100C50 mean?

6. Member
Join Date
Jan 2008
Posts
31
Rep Power
0
Originally Posted by Jasonre

/* cut */

now for the 10,10,10,20,20,30,30,30,400,500
grp 1: 500,30,30,10,10
grp 2: 400,30,20,20,10

/* cut */
take this reply, would it best to get the difference between the two highest numbers then divide it up to
group 1 500, 10, 10, 10, 20.
group 2 400, 30, 30, 30, 20.
group 1 sum 550
group 2 sum 510 // the best we can get here

here we have a difference of 40, were as the difference in the quote is 100.

so you have to get the difference of the two highest numbers then try and get either a number that matches that difference or closest one and ............. it is getting close to 7am in New Zealand I must go to work now

7. numCnum means nCk. say you have 10 numbers and want to divide into two even groups. thats 5 num per group. 10C5 would get you 252 possible combinations. 100C50 would be 100891344545564193334812497256 possible combinations. And that only applys only to bruteforce.java because it checks for all the possible combinations to find the smallest difference.

8. tghn2b, how would you apply your idea to this:
group1: 10, 5, 6, 7, 8
group2: 9, 1, 2, 3, 4

9. Member
Join Date
Feb 2009
Posts
48
Rep Power
0
whow holy shit! this makes my head hurt!

10. Member
Join Date
Jan 2009
Posts
40
Rep Power
0
Originally Posted by tghn2b
now for the 10,10,10,20,20,30,30,30,400,500
grp 1: 500,30,30,10,10
grp 2: 400,30,20,20,10

take this reply, would it best to get the difference between the two highest numbers then divide it up to
group 1 500, 10, 10, 10, 20.
group 2 400, 30, 30, 30, 20.
group 1 sum 550
group 2 sum 510 // the best we can get here

here we have a difference of 40, were as the difference in the quote is 100.

so you have to get the difference of the two highest numbers then try and get either a number that matches that difference or closest one and ............. it is getting close to 7am in New Zealand I must go to work now
Yes this is where the 2nd part comes into play. Because the difference between G1 and G2 > smallest in G2, swap out the smallest of G2 for the next size up in G1. so
G1: 500,30,10,10,10 = 560
G2: 400,30,30,20,20 = 500
rinse and repeat, now we are in the 2nd smallest number in G2... swap for the next largest number in G1.
G1: 500,20,10,10,10 = 550
G2: 400,30,30,30,20 = 510
rinse and repeat... now the 3rd smallest number... hey that's 30 still smaller than difference... the next number in G1 is 500 but the difference of 30 and 500 is Greater than 400 therefore don't swap... hence you have exactly what you said :) this is probably the more difficult thing to wrap your head around... so yes if your head hurt then, you'll probably have a seizsure now...

Sorry i was MIA, :)

Jason

11. Member
Join Date
Jan 2008
Posts
31
Rep Power
0
Originally Posted by angryboy
tghn2b, how would you apply your idea to this:
group1: 10, 5, 6, 7, 8
group2: 9, 1, 2, 3, 4
group1: 10, 5, 6, 7, 8 = 36
group2: 9, 1, 2, 3, 4 = 19

ultimate way
group1: 10, 7, 6, 3, 2 = 28
group2: 9, 8, 5, 4, 1 = 27

well we can never get a equal answer

12. err... can you tell me that in baby steps? haha.

13. Member
Join Date
Jan 2009
Posts
40
Rep Power
0
Originally Posted by tghn2b
group1: 10, 5, 6, 7, 8 = 36
group2: 9, 1, 2, 3, 4 = 19

ultimate way
group1: 10, 7, 6, 3, 2 = 28
group2: 9, 8, 5, 4, 1 = 27

well we can never get a equal answer
Here we go.. what you don't understand is that the main listing needs to be sorted. I will step through the process that has been setup already, tested, and shows. If you are trying to program already what has been done you are clearly missing a step. Steps are broken up by the dotted line.

G1: 10
................
G1: 10
G2: 9
................
G1: 10
G2: 9,8
................
G1: 10,7
G2: 9,8
................
G1: 10,7,6
G2: 9,8
................
G1: 10,7,6
G2: 9,8,5
................
G1: 10,7,6
G2: 9,8,5,4
................
G1: 10,7,6,3
G2: 9,8,5,4
................
G1: 10,7,6,3,2
and then since G1 is full, rest goes in G2
G2: 9,8,5,4,1
................
G1 = 28
G2 = 27

but then we can check it by seeing the difference, 28-27 = 1 which is NOT greater than our smallest value of G2, thereby we know we have the most correct grouping. if we take what you thought was the correct algorithm then you actually can fix the groups by running it through this secondary step which hasn't been programmed into Angryboy's. for instance.
G1: 10, 5, 6, 7, 8 = 36
G2: 9, 1, 2, 3, 4 = 19
the difference is 17 = 36-19, highest number in G2 however G2 needs to be sorted and G1 also so rework your Groupings.
G1: 10,8,7,6,5
G2: 9,4,3,2,1
and then proceed....
1 moves to G1 and smallest in G1 moves to G2. we have
G1: 10,8,7,6,1 = 32
G2: 9,4,3,2,5 = 23
and now the next number in line happens to be at position 2, the number 2 which is smaller than the difference of 9 swap for postion 2...
G1: 10,8,7,2,1 = 28
G2: 9,4,3,6,5 = 27
now the difference is 1, and the 3rd position number is 3 which is greater than the difference therefore this is now the best way to group. hmm this may actually be faster than the first way we do the algorithm but this involves a lot of checking and a lot of theory.

Any questions... or in your case, arguements in which why you don't think we have the correct algorithm... because it seems that you tell us that our way is getting results in which we aren't getting in fact therefore it seems to me that the only one that is programming the algorithm the wrong way is the person who has in fact mis-interupted. please get your facts straight before you try and convince others that an algorithm is in fact wrong which it's actually been programmed and showing expected results (and oh yes, correct results).

Please try again when they are either more intelligent checks or, you just want to know more.. questions are better than comments.. sorry for me being blunt but i kind of get annoyed when we have a couple of people who have thought about this problem and had quite a bit of time, then a newbie comes in spends 10 seconds on thought, choses the easiest grouping (which we have already looked at and shown) and says "see, your way is wrong because i programmed it to be like this"...

ok off my soap box... if you have questions ask, don't comment unless you know that your comments will be looked at...

Jason

14. (every time i thought i was out, they PULL me back in...)
ok, now that i know the steps, i will put it to code. hopefully by monday, we will have 0 diff for 20-10. now, do i have to sort the numbers everytime i swap, and are you going by positions only or the next smallest value?

15. Member
Join Date
Jan 2009
Posts
40
Rep Power
0
do not swap everytime... only the first time. by swapping it means you are sure that it needs to be in the other group... however if you do sort you will need to throw in a check which might be worth having the check in there anyway. the check is, if the difference between the groups is less than the difference the 2 numbers that you are swapping then dont' swap i believe. my logic might be reversed but right now i'm working on something else and can't really give it too much thought... let me know if you need help on the algo...

16. i've put it to code. it worked for 1-10 but fails for 20/10. maybe i'm not getting the algo right, please check the code in your pm. (when you're free, offcourse)

17. Jasonre, MIA 2009 (again).

Page 3 of 3 First 123

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•