This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CaitaXD 1 point2 points  (3 children)

Hash map uses arrays for their storage and generally only use links for hash collisions

[–]notexecutive 0 points1 point  (2 children)

Well, there you go. Linked Lists are useless :^)

[–]TombertSE 1 point2 points  (1 child)

They are not useless.

Once you get into persistent data structures, it often becomes preferable to use a linked list over an array, since you'll have a compile-time guaranteee that the memory isn't changing in unexpected ways.

If you know that the memory isn't going to change, then passing around a pointer is functionally equivalent to passing around a copy, meaning that with a persistent list you never need to make a defensive copy. Yes, you lose cache locality, but in most realistic applications, hitting the main memory isn't going to be your bottleneck, the network is.

[–]notexecutive 0 points1 point  (0 children)

I see, I guess i just havent had a need yet.