94
What is your default sort?
(lemmy.ca)
A loosely moderated place to ask open-ended questions
Search asklemmy ๐
If your post meets the following criteria, it's welcome here!
Looking for support?
Looking for a community?
~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~
quick sort on random input, insertion sort on almost-sorted inputs
Honestly, sorting algos are serious nerd shit. They're for suckers and losers. If it's not worth doing, insertion sort every day of the week. Compute is cheap. If it's actually important, then it's TimSort (it's never important).
In small datasets, the speed difference is minimal; but, once you get to large datasets with hundreds of thousands to millions of entries they do make quite a difference. For example, you're a large bank with millions of clients, and you want to get a list of the people with the most money in an account. Depending on the sorting algorithm used, the processing time could range from seconds to days. That's also only one operation, there's so much other useful information that could be derived from a database like that using sorting.