Aaron, bubble sort is super slow. You can just use the sort method that is in algorithm.h Also the method you use is an approximation algorithm, it won't work for all cases. I came across this test case that broke my similar algorithm
Input:
1
8
120
111
111
101
20
11
11
1
Output ...
Search found 2 matches
- Tue Nov 09, 2010 2:43 am
- Forum: Volume 100 (10000-10099)
- Topic: 10032 - Tug of War
- Replies: 91
- Views: 43648
- Mon Nov 01, 2010 6:57 am
- Forum: Volume 101 (10100-10199)
- Topic: 10194 - Football (aka Soccer)
- Replies: 121
- Views: 64443
Re: 10194 - Football (aka Soccer)
My issue, which I'm embarrassed to say took me a very long time to find, was that there can be more than 9 goals in a game. The java code above also has this problem, you can't just parse a single character. You need to parse the strings between # and @ and @ and #