4 ms·
> The inefficiency in computers is that you need to slide all of the values down a place one by one as you insert numbers. You don't need to do this if you use
by anonytrary 7y ago
> The inefficiency in computers is that you need to slide all of the values down a place one by one as you insert numbers.
You don't need to do this if you use a doubly-linked list, yet the algorithm is still quadratic, so this cannot possibly be the reason why it is quadratic. It is quadratic because you are (in the worst case) comparing every element in the list with every other element in the list.