How to sort 100_000 numbers ??
How to sort 100_000 numbers ??
https://gist.github.com/jack128/42ce4ca25edff48583776a57f22b6a8f
Using TList and Classes.TList give same result: StackOverflow
related link (about .NET issue): https://github.com/dotnet/corefx/issues/24110
updated
qc: https://quality.embarcadero.com/browse/RSP-19091
https://gist.github.com/jack128/42ce4ca25edff48583776a57f22b6a8f
https://gist.github.com/jack128/42ce4ca25edff48583776a57f22b6a8f
Using TList
related link (about .NET issue): https://github.com/dotnet/corefx/issues/24110
updated
qc: https://quality.embarcadero.com/browse/RSP-19091
https://gist.github.com/jack128/42ce4ca25edff48583776a57f22b6a8f
I did a simple test with default stack size sorting the same list using different algorithms:
ReplyDeleteSorting 100000 random integers...
Merge sort: 169 ms
Gnome sort: 96325 ms
Bubble sort: 104646 ms
Quick sort: 19 ms
Obviously the QuickSort is quick (and does not fail with memory errors for me with the given number of elements) but it is not stable. The two inplace sorting algorithms are stable, require no stack memory at all but are very slow. Again, if speed is not an issue they are not that slow, modern web pages can take the same time to load ;-)
Replaced random numers with the test sequence according to RSP-19091 (semi-ordered) and the result is more interesting:
ReplyDeleteMerge sort: 156 ms
Gnome sort: 84941 ms
Bubble sort: 77891 ms
QuickSort: Exception: Stack overflow
Nobody likes Timsort?
ReplyDeleteen.wikipedia.org - Timsort - Wikipedia