19 ms·
"I know sorting algorithms so intimately that I know to not reach for the built in .sort() when the array is already 99% sorted" Built-ins are made to work wel
by stefano 8y ago
"I know sorting algorithms so intimately that I know to not reach for the built in .sort() when the array is already 99% sorted"
Built-ins are made to work well on the most common case. Often, you can use domain knowledge to come up with better solutions. But you need to know how common sorting algorithms work to understand if and when that domain knowledge can be used to speed up your program.
- Waterluvian 8y agoYou're right. I'm being more tongue in cheek about how like 95% of the time just do the default. Your education is really to know when it's important to donut differently.