5 ms·
I wanted a stable sort in one of my projects, so I implemented merge sort Then I had a larger input (like 100k elements) and wondered, why does it take a few
by benibela 4y ago
I wanted a stable sort in one of my projects, so I implemented merge sort
Then I had a larger input (like 100k elements) and wondered, why does it take a few minutes to print the output, when it calculated the output in a second? Well, it was the merge sort being called after the calculation completed to print it sorted. A double fail, because the calculation already produced sorted output in this case.
Now I sort a list of indices with quick sort