I have a small fun project I'm working on to compute NCAA tournament pool points. I've got that working perfectly, but I had the idea of seeing who has the best percentage of winning by getting all possible outcomes from the sweet sixteen to the championship.
The way I have it set up now is that for each team's progression in the tournament, they get a point. So, if they lost in the first round, they get a 0, if they get to the sweet sixteen, they get a 2, and if they become the champs, they get a 6.
So, from the sweet sixteen, there's the following possiblity:
2,2,2,2,2,2,2,2,3,3,3,3,4,4,5,6
disregarding 0's and 1's (first and second rounds respectively).
My problem now is by using permutations (I'm now using the genperm function provided by AltBlue), there are duplicates in the permutations, which not only would screw up the percentage, but also take a couple days to compute.
Does anyone know a way to permute an array with no duplicates? Meaning switches 2's would not result in another permutation. Or if people know of a better way I should be doing this, I'm very open to suggestion.
Thanks in advance.
Avi
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.