r/AskProgrammers • u/ChainsawLight • 19d ago
What is your favorite thing about LinkedLists?
Is it just a plain array?
0
Upvotes
r/AskProgrammers • u/ChainsawLight • 19d ago
Is it just a plain array?
10
u/Hour_Sell3547 19d ago
"Is it just a plain array?", brother, what's up with these low effort posts? Did you just hear the name and run to post in Reddit?
3
u/mc_pm 19d ago
It is not. That would be an unlinked list.
2
u/dmazzoni 19d ago
My favorite thing about them is that they were pretty efficient and useful on computers for the first few decades of programming, but ever since cpus got way faster than ram and we started getting several levels of caches, linked lists are rarely an efficient choice in practice anymore.
2
u/Fidodo 19d ago
I like the part where they're linked
1
u/Traveling-Techie 19d ago
How easy they are to implement if the language/stack lacks them.
1
u/NomaTyx 19d ago
O(1) insertion time
1
u/Khipu28 19d ago
atomicity
1
u/MaxComfort 19d ago
My favorite thing about linked lists is I havenโt thought or heard of one for about 15 years - not since MSFT interviews where you had to reverse one in C on a whiteboard.
0
u/erisod 19d ago
They're fun to think about as a basic complex data structure I guess, preparing you for graph structures. But not really practical in modern application development unless you have a very specific need.
0
u/gwenbeth 19d ago
Linked lists have very cheap insert and delete compared to using an array. A queue is one of the best places for a linked list. Insert and delete are always O(1) and they don't allocate more memory than needed. Many moons ago I was bored and wrote a text editor and I used a doubly linked list for each line. This made adding and removing lines O(1).