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.
时间: 2024-11-08 21:03:56