4 ms·
I don't understand this. Isn't sorting an in-place procedure that does not need to allocate on the heap?
by millstone 10y ago
I don't understand this. Isn't sorting an in-place procedure that does not need to allocate on the heap?
- snuxoll 10y agoSure, as long as you're okay with mutable data structures and the headaches they cause with threading.
- twic 10y agoDepends on the sort. A naively implemented mergesort needs a temporary array of the same size as the the array being sorted. But whilst that takes up a chunk of memory for a while, it shouldn't be the sort of thing that makes GC choke. And anyway, not many people will be using a naively implemented mergesort in this situation!