Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Application of Bertrand's Ballot Theorem in C/C++



In Bertrand's original paper, he explains a proof depended on a general formula for the number of favourable sequences implementing a recursion relation.

Example

Let there are 5 voters, of whom 3 vote for candidate A and 2 vote for candidate B (so p = 3 and q = 2). Ten possibilities are exist for the order of the votes cast −

  • AAABB

  • AABAB

  • ABAAB

  • BAAAB

  • AABBA

  • ABABA

  • BAABA

  • ABBAA

  • BABAA

  • BBAAA

For the order AABAB, the tally of the votes as the election progresses is given below −

Candidate A A B A B
A 1 2 2 3 3
B 0 0 1 1 2

For each column the tally for A is always greater than the tally for B so the A is always strictly ahead of B. For the order AABBA the tally of the votes as the election progresses is given below −

Candidate A A B B A
A 1 2 2 2 3
B 0 0 1 2 2

With respect of this order, B is tied with A after the fourth vote, so A is not always strictly ahead of B. Of the 10 possible orders, A is always ahead of B only in case of AAABB and AABAB. So the probability that A will always be strictly ahead is 2/10=1/5 and this is indeed equal to 3-2 / 3+2 as the theorem predicts.

Updated on: 2020-01-29T07:51:43+05:30

168 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements