If your array is very large, deleting or adding elements near the beginning of the array can be expensive as all elements after the deleted or added element must be re-indexed. In a linked list, removing a node only affects one other node.
The trade off is the expense of traversing the linked list.
If you don't have to traverse very far on the list, the performance gain for adding and removing items near the beginning of the structure can be very significant, finishing in milliseconds instead of minutes.
That is awesome example! And thanks for perf tests you did!! I really forgot about that stuff, shame on me :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.