Microsoft Interview Question
Software Engineer / DevelopersIsn't it similar to the question "In a rectangular cake, a smaller rectangle of any size and orientation is cut out. Draw a single cut in the rest of the piece to cut in two halves."
Thus find the centroid of the batch of points by finding averages of x and y separately and then draw a line going through the calculated centroid and (1/2, 1/2).
Its classification problem you can use Linear Perceptron algorithm, where you have to solve the eq
Use a linear-time selection algorithm to find the median point under the order of increasing x then y. The two halves resulting are both contained in convex regions weakly separated by a vertical line. (If the interviewer gets cranky about the boundary, rotate the line a fraction counterclockwise and make some noise about the imprecision of floating point arithmetic.)
- Anonymous March 09, 2010