15,306,209 members

Welcome to the Lounge

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 Re: How do you understand cryptic code? honey the codewitch7-Jul-21 4:38 honey the codewitch 7-Jul-21 4:38
 Re: How do you understand cryptic code? NightPen7-Jul-21 6:44 NightPen 7-Jul-21 6:44
 Re: How do you understand cryptic code? hur10forcer108-Jul-21 2:38 hur10forcer10 8-Jul-21 2:38
 How hard can tallying ranked voting be? swampwiz6-Jul-21 4:38 swampwiz 6-Jul-21 4:38
 Re: How hard can tallying ranked voting be? Slacker0076-Jul-21 5:54 Slacker007 6-Jul-21 5:54
 Re: How hard can tallying ranked voting be? Matthew Dennis6-Jul-21 6:13 Matthew Dennis 6-Jul-21 6:13
 Re: How hard can tallying ranked voting be? PIEBALDconsult6-Jul-21 6:22 PIEBALDconsult 6-Jul-21 6:22
 Re: How hard can tallying ranked voting be? Jon McKee6-Jul-21 15:13 Jon McKee 6-Jul-21 15:13
 If we use bit groupings for the ranks of each candidate, that would look something like: Bits per candidate: floor(log_2(candidateCount)) + 1 Bits per vote: candidateCount * bitsPerCandidate Total space for election: voters * bitsPerVote So given 300,000,000 voters with 12 candidates: space = 300,000,000 * 12 * (floor(log_2(12)) + 1) space = 14,400,000,000 bits or 1.8 GB Given the same amount of voters with 24 candidates: space = 300,000,000 * 24 * (floor(log_2(24)) + 1) space = 36,000,000,000 bits or 4.5 GB Space definitely isn't the issue. What about the algorithm? 1) Bin every vote by first-pick candidate. 2) If no bin is >50% of the votes, re-bin the lowest bin and repeat #2. 3) The >50% bin is your winner. I honestly don't see why this would be an issue. Worst case scenario something like v+(c-2)*(v/2) run-time where v is the vote count and c is the number of candidates. v/2 is just a napkin-math average since the redistributed bins would start out small and grow as the candidate list got shorter. Again, just a bunch of napkin math so I probably missed something but I never bought the "it's too hard to compute" excuse either And I'm sure there are clever tricks to reduce the time required. EDIT: For reference, if processing a vote takes: 1 microsecond: 30 minutes to determine a winner @ 300M votes, 12 candidates 1 millisecond: 20 days, 20 hours to determine a winner @ 300M votes, 12 candidates And this is a single-threaded, un-optimized, brute-force approach.modified 6-Jul-21 21:48pm.
 Re: How hard can tallying ranked voting be? Dan Neely7-Jul-21 2:53 Dan Neely 7-Jul-21 2:53
 Re: How hard can tallying ranked voting be? Jon McKee7-Jul-21 7:09 Jon McKee 7-Jul-21 7:09
 Re: How hard can tallying ranked voting be? Dan Neely7-Jul-21 7:17 Dan Neely 7-Jul-21 7:17
 Re: How hard can tallying ranked voting be? Jon McKee7-Jul-21 7:57 Jon McKee 7-Jul-21 7:57
 Re: How hard can tallying ranked voting be? RDM Jr7-Jul-21 9:16 RDM Jr 7-Jul-21 9:16
 Thought of the Day OriginalGriff6-Jul-21 4:16 OriginalGriff 6-Jul-21 4:16
 Re: Thought of the Day dandy726-Jul-21 4:32 dandy72 6-Jul-21 4:32
 Re: Thought of the Day W∴ Balboos, GHB6-Jul-21 4:36 W∴ Balboos, GHB 6-Jul-21 4:36
 Re: Thought of the Day Kschuler6-Jul-21 5:19 Kschuler 6-Jul-21 5:19
 Re: Thought of the Day jeron16-Jul-21 5:33 jeron1 6-Jul-21 5:33
 Re: Thought of the Day megaadam6-Jul-21 5:41 megaadam 6-Jul-21 5:41
 Re: Thought of the Day jeron16-Jul-21 7:44 jeron1 6-Jul-21 7:44
 Re: Thought of the Day DRHuff6-Jul-21 11:14 DRHuff 6-Jul-21 11:14
 Re: Thought of the Day Daniel Pfeffer6-Jul-21 11:23 Daniel Pfeffer 6-Jul-21 11:23
 Breath Analysis grralph16-Jul-21 1:57 grralph1 6-Jul-21 1:57
 Re: Breath Analysis SeeSharp26-Jul-21 2:11 SeeSharp2 6-Jul-21 2:11
 Re: Breath Analysis grralph16-Jul-21 22:09 grralph1 6-Jul-21 22:09
 Last Visit: 31-Dec-99 18:00     Last Update: 21-May-22 8:51 Refresh ᐊ Prev1...1076107710781079108010811082108310841085 Next ᐅ

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Straw Poll

On which operating systems are you writing code?
Let's see if things have changed since we last ran this. "writing code" meaning editing, building, and running the code on that OS.
 Linux (any flavour) macOS / OSX Windows Unix (any flavour) Other
Results   820 votes