3 ms·
>It can be as simple as Arrays vs. LinkedLists; where Arrays have zero cost access and LinkedLists have high indexing costs, but low constant time insertion cos
by palunon 10y ago
>It can be as simple as Arrays vs. LinkedLists; where Arrays have zero cost access and LinkedLists have high indexing costs, but low constant time insertion costs where you don't know the content length.
But then in the real world, arrays can still be faster than lists even when you're inserting a lot...
https://www.youtube.com/watch?v=YQs6IC-vgmo https://www.youtube.com/watch?v=YQs6IC-vgmo
- bluejekyll 10y agoYes, if you can afford the allocation of the memory upfront Arrays are always faster :) My point was more that understanding the semantics of the two types is important to how the program will run.