4 ms·
You use the one labeled "sort" and trust the standard library chose reasonable defaults. It's not like the standard lib is going to use bubble sort. If the rea
by throwaway2016a 10y ago
You use the one labeled "sort" and trust the standard library chose reasonable defaults. It's not like the standard lib is going to use bubble sort.
If the reasonable defaults aren't good enough... you're in the 10%.
- stale2002 10y agoIt is not about choosing "sort" it is about knowing if you need your data sorted in the first place. Sure, in some situations it might be obvious, but maybe not obvious for others. And things that are immediately, blindingly obvious to a 5 year experience programmer may not be obvious to a newbie. Ex: imagine if you didn't know what a hashtable or a dictionary was and just used single variables for everything.
- jhomedall 10y agoThere's a lot more to data structures and algorithms than sorting. For example, just knowing that bloom filters or interval trees exist opens up a ton of options, even if you don't implement them yourself. For that matter, the choice of sorting algorithm can have security implications. QuickSort on user-facing data can easily become a DoS vulnerability.