Question

You are tallying votes from an election in which n people voted. If any candidate gets...

You are tallying votes from an election in which n people voted. If any candidate gets more than half (at least ⌊n/2⌋ + 1 votes), they win. Otherwise a runoff election is needed. For privacy reasons you are not allowed to look at any one ballot, but you have a machine that can take any two ballots and answer the question: “are these two ballots for the same candidate, or no?”

(a) Design and analyze a divide and conquer algorithm that decides whether a runoff is needed after O(n log n) ballot equality tests, assuming that n = 2k for some integer k.

(b) Explain how to modify your algorithm from (1a) to deal with arbitrary n.

(c) Extra Credit (10 points) Give a O(n) algorithm.

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
You are tallying votes from an election in which n people voted. If any candidate gets...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • a) Devise a divide-and-conquer algorithm that determines whether the two candidates who received the most votes...

    a) Devise a divide-and-conquer algorithm that determines whether the two candidates who received the most votes each received at least n/4 votes and, if so, determine who these two candidates are. [Hint: a candidate could not have received a semi-majority of votes in the overall election without receiving a semi-majority in the first half of votes or a semi-majority in the second half of votes (note: you need to defend this).] b) Use the master theorem to give a big-O...

  • Ranked choice voting is a system of tallying election ballots that is used in many national...

    Ranked choice voting is a system of tallying election ballots that is used in many national and local elections throughout the world. Instead of choosing a single candidate, voters must rank the available candidates in the order of their choice. For example, if three candidates are available, a voter might choose #2, #1, and #3 as their choices, with #2 being their first choice, #1 the second, and #3 the third. The outcome is determined by a runoff, which follows...

  • the question from the course COMP 4040 that Analysis of Algorithms if you want to answer it by code please use C or C++...

    the question from the course COMP 4040 that Analysis of Algorithms if you want to answer it by code please use C or C++ 5. Algorithm Design (20 points) Input: array A contains n distinct numbers from 1 to n, in arbitrary order. Output: number of inversions (defined as the number of pair(i, j) of array indices with i < j and A[i] > Aj]) (a) (5 points) What array with elements from the set {1, 2, ..., n) has...

  • You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n...

    You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n numerical values—so there are 2n values total—and you may assume that no two values are the same. You’d like to determine the median of this set of 2n values, which we will define here to be the nth smallest value. However, the only way you can access these values is through queries to the databases. In a single query, you can specify a value...

  • dont need help on the first two pictures, only need help underatanding these: number 1,2,3,4,5,6. please help:/...

    dont need help on the first two pictures, only need help underatanding these: number 1,2,3,4,5,6. please help:/ O Yes. The Condorcet winner is never the majority winner Yes. The Condorcet winner is not required to receive over 50% of the possible vote. O No. The Condorcet winner is automatically the majority winner. No. The Condorcet winner always receives over 50% of the possible vote. 7. Using this preference schedule, which candidate is the Condorcet winner? (1 point) number of votes...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT