|
|
|
|
|
by jackmott
3131 days ago
|
|
If you iterate over the list within an order of magnitude as often as you remove an element from the middle, an array will still be faster despite not having constant time removal, no matter the size of the list. To restate, if you have a workload where you iterate over your collection ~500 times, and remove an element from the middle ~1000 times, an array will usually outperform a linked list on a modern computer, no matter the size of the list. It is not until you do removes/adds far more often, and far from the end of the collection, that the linked list will perform better overall. |
|