by bunderbunder · 14y ago · 0 comments
For certain applications where you already have a pointer to position n by the time you find out you need to insert there, then insertion does end up taking constant time as long as it's not a persistent linked list. But big-O is for describing the worst case, not the ideal case that you can achieve given certain optimizations.
mdwrigh2 is totally right. I flipped the O(1) for linked list insertion with the O(n) for verctor insertion :).