Cracking the Coding Interview: Fourth Edition (308 page e-book / PDF)
Delivered instantly as a PDF via email. For Software Engineers & SDETs
  • 150 programming interview questions and answers
  • 5 proven approaches to crack algorithm questions
  • 10 mistakes candidates make, and how to avoid them.
  • How to prepare for technical and behavioral questions without wasting your time!
"The BEST book for acing your interview. It helped me land my Microsoft job, and it was worth every penny!" - Ravi (Accepted at Microsoft, Amazon and Facebook) 30 Day Money Back Guarantee: Don't love the book? We'll give you your money back! More Info

Saturday, April 24, 2010

Merge Sort

What is the time and space complexities of merge sort and when is it preferred over quick sort?

2 comments:

  1. space complexity for merge sort is o(n) where as quick sort is o(1). worst case time complexity is o(n^2) for merge where as quick sort is o(nlogn)

    ReplyDelete
  2. @satheesh: Worst case time complexity for merge sort is O(nlogn) and for quick sort is O(n^2) when the input is sorted.

    ReplyDelete