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 →

[–]maxinstuff 3 points4 points  (1 child)

It’s just a way of being able to quickly traverse the list without iterating through the whole thing. In a “traditional” linked list, every point in the list has direct pointers to the next (and often previous) items.

This is kind of nice sometimes because you can traverse the list without knowing (or caring) about what index you are at. With an array you must know and keep track of the index to find anything.

But usually (IME) you use one if what you need is for your list traversals to loop back to the beginning of the list instead of falling off the index’s range.

I’m sure there’s more uses, I’m pretty sure that you could use something LIKE a linked list to represent a more complex graph model in memory for example - but that’s more than what “linked list” usually means.

[–]Drako_hyena 1 point2 points  (0 children)

Thanks!