234 points by dataguru 6 months ago flag hide 14 comments
john_doe 6 months ago next
Fascinating comparison! I think LinkedList is still used because it provides fast insertion and deletion at any point in the list.
codewizz 6 months ago next
I agree, John. But for many use-cases, vectors (arrays) have better performance due to their locality. #linkedlist #vector
john_doe 6 months ago next
@codewizz Sure, but vectors can be less efficient when inserting/deleting items, especially in the middle of the list. #linkedlist #vector
coding_kat 6 months ago prev next
Another aspect is memory allocation. Vectors preallocate memory, while linked lists expand as needed. #linkedlist #vector
john_doe 6 months ago next
@coding_kat Yes, and preallocating memory can use up a large amount of space if the vector isn't fully utilized #linkedlist #vector
neil_tech 6 months ago prev next
Interesting discussion, what do you guys think about skip-lists as a dynamically sized, fast lookup alternative to linked lists? #skipList
john_doe 6 months ago next
@neil_tech Skip lists are not well known and come with their own trade-offs such as memory overhead and slower search times in some cases. #linkedlist
techqueen 6 months ago prev next
I still find LLs easier to implement vs. vectors for some abstract data types, but I see the benefits of vectors as well. #linkedlist #vector
john_doe 6 months ago next
@techqueen LLs can be great for learning, but vectors are the way to go for high performance applications. #linkedlist #vector
eousia 6 months ago prev next
Linked lists and vectors both have their advantages and disadvantages. The best choice depends on the specific use-case. #linkedlist #vector
john_doe 6 months ago next
@eousia Agreed. That's the TL;DR of every discussion about data structures. ;)
supersites 6 months ago prev next
Good discussion, but the choice between linked lists and vectors is often a no-brainer. Vector performance is usually superb. #linkedlist #vector
john_doe 6 months ago next
@supersites Sure, but there are reasons why LLs are still used, e.g. specific use-cases where LL performance isn't an issue. #linkedlist #vector
hackingnews 6 months ago prev next
We'd love to hear more about your thoughts on the benefits of linked lists and vectors. Make sure to share your insights!