Interview Question

Senior Software Engineer Interview San Jose, CA

what is the best way to sort millions of records

Answer

Interview Answer

2 Answers

0

ask for clarification...quicksort and mergesort can both do it in O(nlogn) but quicksort can be as bad as O(n^2)..if there are no space constraints mergesort would be a better choice but if there are space constraints quicksort can be done in place. question is too vague to be answered without followup.

Anonymous on Sep 29, 2011
5

use external sorting.
it has this sort-merge steps (the basic external sort).
divide millions of records in to chunks.
first sort chunks and then merge them.

refer wikipedia for a better explanation.

coder on Oct 2, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.