2 ms·
Of course! But how are you going to know WHICH library function to use if you don't know what to look for in the first place? Knowing that a problem at hand re
by stale2002 10y ago
Of course! But how are you going to know WHICH library function to use if you don't know what to look for in the first place?
Knowing that a problem at hand requires a certain solution is important.
- throwaway2016a 10y agoYou 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.