Question: Mr . Minion has arrived in an 2 D world, where Mr . Minion is walking from left to right. There are light sources that
Mr Minion has arrived in an D world, where Mr Minion is walking from left to right. There
are light sources that are above the line at different heights, and the ith light illuminates a
triangular area where the pick of the triangle is the light source and the base Xi Xri
where Xi Xri is the line segment it can illuminate. Mr Minion is given the arrays
X and Xr In addition, there is a dictionary L that given Xi returns Xri and vice
versa. Fortunately, all these numbers are distinct.
Our goal is to nd a point p in the line that is illuminated by the maximum number of lights.
Write an algorithm to help Mr Minion by nding the point p Write an algorithm, an
argument of why the algorithm is correct, and analyze the running time.
HARD CONSTRAINTS: Your algorithm must be described as a sequence of steps.
Pseudocodes are not allowed. Mr Minion does not like to use unnecessary computer memory.
So your algorithm can use at most O additional memory. This means you cannot create
a new array or binarysearchtree like data structures. If you want to sort, you can use
HeapSort which uses O additional memory and takes On log n time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
