Goldman Sachs Interview Question for Software Engineer / Developers






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

i dont know the answers can anybody explain this in Detail

- Subhash April 02, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The above method is Binary Search. Its worse case is log(n).

- vodangkhoa April 02, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@khoa, yep its binary search but the array input from user need not be monotonously increasing, instead it can be quite unordered!
though the program might exit after log(n) steps, yet it might not be able to find an element in the array even though that element is present in it since it searches in the wrong half, since the program is designed for monotonously increasing sequences.

- nc September 10, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think the array will always be an increasing (sorted) one...Otherwise there is no point in doing this search...the worst case is log(n) time...

- Anupam April 10, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

worst case is o(n) as it would be like linear search each time array is breaking into two halves with size 1 and other n-1;

- sourabhjakhar July 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

worst case is o(n) as it would be like linear search each time array is breaking into two halves with size 1 and other n-1;

- sourabhjakhar July 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The array is sorted in ascending order and it is clearly ln(n) worst case order.

- ak April 11, 2011 | 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