I have a linked list and I'm experimenting with both Mergesort and QuickSort algorithms.
I do not understand why the sort operation in std :: list is so fast. Looking at std :: list under linux, it is also a linked list, not an array.
Merge Sort. I tried an almost identical version of Dave Gamble here: Merge Sort linked list
Also, I thought I would try a simple quicksort based on this code: http://www.flipcode.com/archives/Quick_Sort_On_Linked_List.shtml
Surprisingly, sorting 10 million random numbers using std :: list and sort was about 10 times faster than any of these others.
And for those who ask, yes, I need to use my own list class for this project.
algorithm linux g ++ stdlist
Matt Jul 18 '11 at 4:18 2011-07-18 04:18
source share