Microsoft Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

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 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I don't think that would work .

- Vincent.Y.Guo March 10, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

What is your solution then?

- cirus March 15, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

find median in O(n) time for the x-coord / y-coord only.

- Anonymous March 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Isn'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).

- Anonymous March 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its classification problem you can use Linear Perceptron algorithm, where you have to solve the eq

- Anonymous March 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, that would be helpful.

- Vincent.Y.Guo March 18, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about sorting the points by their slopes wrt origin and then find the median? Would it give the slope of line that would divide the points in space equally?

- Anon March 21, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what if all points are in the same slope

- Vincent.Y.Guo March 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

sorting the points on x coordinate and then y coordinate ..and then finding the middle point i.e. median ..will a line passing through that point will divide all points in equal halves???

- Anonymous September 14, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More