3 ms·
Not necessarily.Not all algorithms are universally applicable, nor are they universally desirable on all inputs. For example, if you have a very long (practica
by KirinDave 9y ago
Not necessarily.Not all algorithms are universally applicable, nor are they universally desirable on all inputs.
For example, if you have a very long (practically infinite) stream of mostly ordered items coming in and you want to semi-order a sliding window so downstream consumers have an easier time, what do you do?
You can't just call Array#sort.
Another example in the same vein: You get a large and mostly sorted dataset on an older 32 bit machine. It's about 500 million elements long, and loaded in memory on Python. Which sort algorithm do you use?