Interview Question






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

Keep two pointers to the arrays, go as in merge-sort's merge step, stop at the Nth entry. It will be in either of the two arrays. Return the value.

- Ananamas October 22, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Almost there. Since there are 2N elements, the median will be the average of the Nth and (N+1)st entries.

- Bullocks December 31, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Well...

Depends on your definition of median.

The way I know it is that the median(s) of a set belong to it. So in case of even number of elements, there are two medians, the Nth and N+1st.

- Anonymous December 31, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

In fact the median is well defined for any ordered set. There is no need for the concept of 'average' to hold.

- Anonymous December 31, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

cormen et. al exercise 9.3.7.

Instructor's manual has the solution for it.

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

cormen et. al exercise 9.3.8.

Instructor's manual has the solution for it.

- Anonymous February 04, 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