❔ when is it appropriate to use a linked list over a normal list ?
Ive been bumping my head on linked lists for a day now, not really focusing on studying linked lists but ive looking at others use them and such so my question is, when should i use linked lists of normal lists?
10 Replies
If you need for the data to be sequentially accessed then LinkedList, otherwise List
99.99% you'd want List over LinkedList
so, linked list if the data inside it is like, structured in a way thats good to be accessed sequentially as u said
thats all ?
basically never
💀
Unless you're using massive lists, and also doing many inserts, then maybe.
alright got it then
thanks
As always, I'll link my favorite Jason Turner talk: https://www.youtube.com/watch?v=uzF4u9KgUWI
It's C++, but the thing about linked list vs sequential containers is basically the same.
The TL;DR is, he measured the difference in one of his bigger project (Chai Script), where he used linked lists where he thought it made sense. The end result: there's no linked list anymore in the codebase
That's also what I was basing my opinion off of 😁
I just forgot who did the talk
One of the biggest c++ legends who's actually very interactive with the community and doesn't just live in the committee ofc 😉
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.