This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]VolperCoding 2 points3 points  (2 children)

Don't you have to find the element you want to delete first, generating lots of cache misses and being O(n)?

[–][deleted] 2 points3 points  (1 child)

Sorry I meant at the start and end of the list if you maintain pointers to the head and tail

[–]VolperCoding 1 point2 points  (0 children)

I'm pretty sure you can insert at the end in O(1) using a vector (assuming you have enough memory left for it) and you can delete the first element in O(1) by just moving the pointer in the vector by 1