In defense of linked lists
Linked lists are great. But they have the problem that, almost always, whatever problem you're trying to solve would be better done with a regular resizable vector.This includes problems that they should be great for, like insert into the middle or the front.The reason is that in practice the way computers actually work is that there is an enormous time penalty for jumping around randomly in memory, and it's large enough that it's often worth paying a O(lg n) cost to switch to something that will be contiguous in memory and allow the CPU to prefetch data.There are exceptions when you really should use an actual linked list, but your default should be a vector and not a linked list.