# Search:

Type: Posts; User: dark3stnit3s

1. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

I cant think of a reason to use it.
2. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

No i must have misunderstood you

1 would beat all of them
followed by 2

the position from the left determines their place
the first from the left is the first place winner for each voter
3. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

7 would only beat 8
4. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

it is important to a degree because I am trying to find the winner...but as i said before there is a possibility of no winner
5. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

I don't know if I quite understand your last statement but to clarify in a row with 3 columns, the first number is the first place position and it beast the last two, the middle is 2nd place and the...
6. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

The algorithm currently being used is that the first candidate is compared to every candidate in the list. Then the second is compared to everyone in the list and so on to determine what position the...
7. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

the 3 3 equates to the number of voters and number of candidates
the 1st row is how the first voter would rank the candidates - ie. 0 1 2 (0 would win followed by 1 and last 2).
each row is a...
8. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

right now, I think it compares the first candidate to every other candidate. Then it moves to the second and compares... But what I think will be the fastest if it could store the positions of the...
9. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

here is the whole output... There are a total of 25 "elections"
Winner of election 1 is candidate 1
TimeExec: Election 1: 0.0050s
No winner for election 2
TimeExec: Election 2: 0.0010s
No...
10. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

I know that the search cannot be linear. I think I just need to compare the winner like if 0 beats 1 then don't compare 2 to 1 compare 2 to zero because if two beats zero it will also have more...
11. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

here is some of the output I get when I run but after this it takes about an hour to get the next result due to the vastness of infile and the poor algorithm.
Winner of election 1 is candidate 1...
12. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

here is the missing class:

import java.io.OutputStream;
import java.io.PrintStream;

/**
*
* A utility class used to time the execution of a Runnable
*/
13. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

here is a bit of the infile:
3 3
0 1 2
1 0 2
2 1 0
3 3
0 1 2
1 2 0
2 0 1
4 5
14. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Re: Program Optimization

the infile is just a sequence that equates to an "election". Basically I just need any kind of tips on how to reduce the amount of for loops in order to speed this program up because as of right now...
15. ## Thread: Program Optimization

by dark3stnit3s
Replies
31
Views
1,266

### Program Optimization

I was given a program in one of my 300 level college classes. It supposed to calculate winners of voters voting on candidates in a specific order. The assignment is to look at the code and try to get...
Results 1 to 15 of 16