9.4 If you have a 2 GB file with one string per line, which sorting algorithm would you use to sort the file and why?


What are the common sorting algorithms?

http://en.wikipedia.org/wiki/Sorting_algorithm


Merge sort, divide and conquer

Quick sort, using a pivot. all numbers bigger than pivot goes one side.

Insert sort

bubble sort, swap. shell sort.

Heap sort?

...


If a 2 GB file, with one string per line.

Properly using a merge sort with multiple threads. (not spliting to 2 parts, but N parts. And Merge from N.


)

This is because we don't need to load the 2GB data into memory all the time.

And multi-threads helps speed up.