In defense of linked lists
Linked lists are great. But they have the problem that, almost always, whatever problem you&#x27;re trying to solve would be better done with a regular resizable vector.<p>This includes problems that they should be great for, like insert into the middle or the front.<p>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&#x27;s large enough that it&#x27;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.<p>There are exceptions when you really should use an actual linked list, but your default should be a vector and not a linked list.