Question: Gerrymandering is a process where voting districts are drawn to achieve various political goals, such as maximizing the number of voters from a certain party,
Gerrymandering is a process where voting districts are drawn to achieve various political goals, such as maximizing the number of voters from a certain party, rather than to achieve geometric goals, such as having districts drawn to have generally round or square shapes. This process often gives rise to very complicated shapes for voting districts, and it can sometimes be challenging to determine whether a giving person is inside or outside a given district, due to the ways it can wind around. Suppose, then, that you are given a voting district defined by an n-vertex simple polygon, P. Give an O(n)-time algorithm for testing whether a point q is inside or outside of P. You may assume that q is not on the boundary of P and that there is no vertex of P with the same x-coordinate as q.
Step by Step Solution
3.51 Rating (168 Votes )
There are 3 Steps involved in it
Let r be a ray emanating vertically up ... View full answer
Get step-by-step solutions from verified subject matter experts
