Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
chkas
· 6y ago · 0 comments
This Quicksort is almost twice as fast
https://rextester.com/XHCGA23293
Comments
[–]
pvidler
6y ago
Only in the random case. Already sorted in either direction and it's ~10x slower.
[–]
chkas
OP
6y ago
Who wants to sort sorted data. If the input data is more often sorted, you can test this before sorting.
[–]
dgudkov
6y ago
Data can be
partially
sorted and it happens quite often. As I understood, it's exactly the purpose of quadsort - to leverage locally ordered sequences.
[–]
imtringued
6y ago
Sort your data. Store it somewhere and then later add more unsorted data.
[–]
simias
6y ago
Sorting sorted or mostly-sorted arrays is not uncommon in many use cases.
[–]
chkas
OP
6y ago
"Mostly-sorted" is a very vague definition.