Sunday, 8 March 2015

Linked Lists: Lists with Links

This week the main topic of focus has been linked lists, a chain of information in which a single list contains two values, one object and a link to another list of the same, or else None.

My most common hiccup when thinking about this concept is the difference between  linked list and nested list. It helped to punch one out and compare it to what a linked list has been described to me as.

Nested List -> [1, [2,[3, None]]]


While a nested list's lists literally contain a list as their second (or third, or fourth... etc) value, the difference between such a list and a linked list is that the simplicity of a linked list is in it's two-value length: a data value, and then a reference to another list of the same type (or None if at the end of the list).

Nested Lists are Russian Dolls, Linked Lists are Conga Lines:



In all honesty, Conga lines really are a lot more fun.

Cheers!
ES

1 comment:

  1. I just watched the video you posted about a month ago about randomness and the NES and it was very fascinating. It reminded me of a video which you might find interesting if you're familiar with final fantasy vii. It gave me some insight into how ffvii's random encounters are programmed.
    https://www.youtube.com/watch?v=g36-lzRCb68

    ReplyDelete