Goldman Sachs Interview Question for Analysts






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

Quick sort: worst case O(n^2)
average case O(nlogn)
best case O(n)

Merge sort: worst case, average case, best case O(nlogn)

Bubble sort: worst case, average case, best case O(n^2)

correct me if im wrong.

- yours.ramesh January 31, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Best case: O(n) really man??!! Prove that and you will get a noble prize!! Haha...linear time sorting..

- Anonymous February 04, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Best case is when it already sorted thus no modification is done.
It only loop if there was 1 modification done thus O(n)

- Anonymous February 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

oh my mistake...it is O(n^2) worst case and O(nlogn) best case for quick sort

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

Formatted:

Name		Best			Average		Worst

Bubble Sort	O(n)			O(n2)		O(n2)
Merge Sort	O(n log n)		O(n log n)		O(n log n)
Quick Sort	O(n log n)		O(n log n)		O(n2)

- Srigopal Chitrapu December 11, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Bubble Sort best is O(n^2) and not O(n)

- neerajlakhotia08 July 30, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Name Best Average Worst

Bubble Sort O(n) O(n2) O(n2)
Merge Sort O(n log n) O(n log n) O(n log n)
Quick Sort O(n log n) O(n log n) O(n2)

- Srigopal Chitrapu December 11, 2013 | 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