3 ms·
Or if I am actually sorting stuff, I'm using the sort provided by the standard library. I don't think I've ever implemented a sort outside of an academic contex
by nwallin 7y ago
Or if I am actually sorting stuff, I'm using the sort provided by the standard library. I don't think I've ever implemented a sort outside of an academic context. Used them plenty of times, but I couldn't imagine not using the standard library.
Schools talk about sorting algorithms because it's instructive, not because they're important problems. You can explain the problem in thirty seconds, and even if you explain it badly, everyone will have an intuitive understanding of the problem.
Then you can show students intuitive algorithms of insertion sort and selection sort and they'll understand the algorithm.
Then you time it. Then you show them weird non intuitive algorithms like heap sort or quicksort and show that they're a ton faster. Not a lot faster, but like way way way faster.
Then your students understand they'll need to carefully consider their algorithms and all the ramifications moving forward.
If you start a CS101 student with a hard algorithms problem they'll switch majors. And that will be your fault for being a shitty teacher, not their fault for being lazy or dumb.