Answered step by step
Verified Expert Solution
Question
1 Approved Answer
With a big election year upon us 2 , let s look at a problem inspired by elections, among others. Imagine that you have n
With a big election year upon us lets look at a problem inspired by elections, among others. Imagine that youhave n voters, and you want to set up k polling places for them to vote at These polling places should be chosensomewhat fairly There are m candidate locations from which the k places are chosen, and we will assumethat m n The idea is to choose k places so that each is convenient for nk voters. To avoid annoyingdetails we assume here that kn The input to the problem is an n times m matrix of all the distances dij between voters and polling places: dij is the distance from voter i to polling place j We will assume that notwo distances in the matrix are the sameThere are of course many precise formulations of this problem, and many algorithms to choose k polling places;one very reasonable algorithm which happens to have some useful fairness notions, but we will not focus onthose here is Algorithm You might want to execute it by hand on paper by drawing circles which graduallyget bigger, to see how it works.Algorithm POLLING PLACE SELECTIONInitially all voters are active, and all polling places are unopened.The time t increases continuously.At time t each active voter i is assigned temporarily to all unopened polling places j at distance t or less from iif an unopened polling place j has at least nk voters assigned to it thenOpen that polling place jMake those nk voters inactive.Keep doing this, increasing t continuously, until no more voters are active.Obviously this algorithm is phrased informally, using many types of commands that you dont have in normalprogramming languages. This question is about implementing it precisely and efficiently.Hopefully, you all plan to vote.This should be true if you measure distances in micrometers.a We wrote Open that polling place j You might legitimately worry that the algorithm is underspecifiedif there are multiple polling places j j that each reach nk voters at exactly the same time t Explain whythis is not a concern here.b As we said above, the description about continuously increasing t and looking what happens is not programmingfriendly Here, you are to describe how to implement this algorithm to run in time On log nSee below for the case when you find that difficult. In doing so you will almost certainly want to draw onmultiple algorithms and data structures you learned in CSCI as well as some mathematical knowledgeabout logs and other functions.You should not give actual code here rather, give pseudocode which a competent CSCI studentcould easily turn into actual PythonC code. Also, if you use algorithms or data structures from CSCIor CSCI you do not need to actually give the code simply say which algorithm or operationyou are calling such as Run BFS from node v and store the distances in an array xc Explain informally why your detailed algorithm returns the same result as our informal continuoustimealgorithmd Carefully analyze the running time and show that it is On log nNote that we are only asking for theupper bound of On log n here, not a lower bound of Omega n log n though the latter would be easy toprove For any algorithms or data structures you learned in CSCI you can simply state the runningtimes that you were taught and use in your analysis no need to reprove them yourself.If there are some parts that you cannot get to run in On log n explain which those parts are, what obstaclesyou were facing, and what you would need to make it work. The more parts you can get in On log n thecloser to full credit you will be If your algorithm runs in On you will get partial credit, depending on howmany key parts are faster.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started