2. Pipeline in a village
We have coordinates of N houses in a rectangular
village, find out the equation of a straight pipeline
parallel to x axis, from which the sum of the
perpendicular distances of all the houses will be
minimum.
For example:
House coordinates: (2,3), (4,2), (3,5), (7,1),(2,9), (5,1).
(8,8)
Pipeline equation, y=3.0
Answers
Answered by
2
Answer:
If no coordinates is given then answer is -1
otherwise, calculate median of by using y - coordinates only ignore x - coordinates.
So, the answer is median of list of y - coordinates.
Explanation:
Similar questions