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 2D 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 [X[i], Xr[i]],
where X[i]< Xr[i], 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 X[i], returns Xr[i] 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(1) additional memory. This means you cannot create
a new array or binary-search-tree like data structures. If you want to sort, you can use
HeapSort which uses O(1) additional memory and takes O(n log n) time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!