C
C#2y ago
Despy()

❔ 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
Cattywampus
Cattywampus2y ago
If you need for the data to be sequentially accessed then LinkedList, otherwise List 99.99% you'd want List over LinkedList
Despy()
Despy()OP2y ago
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 ?
phaseshift
phaseshift2y ago
basically never
Despy()
Despy()OP2y ago
💀
phaseshift
phaseshift2y ago
Unless you're using massive lists, and also doing many inserts, then maybe.
Despy()
Despy()OP2y ago
alright got it then thanks
LPeter1997
LPeter19972y ago
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
phaseshift
phaseshift2y ago
That's also what I was basing my opinion off of 😁 I just forgot who did the talk
LPeter1997
LPeter19972y ago
One of the biggest c++ legends who's actually very interactive with the community and doesn't just live in the committee ofc 😉
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server