Tuesday, 31 March 2015

Week 8: Linked Lists

Linked lists are another data type that is interesting to me. I think of linked lists as a freight train (especially as node data is called cargo!). As you manipulate the linked list, you are still able to keep the order of the list without disrupting other data. If you imagine a freight train, you can add another cargo car to an appropriate section of the train and link them together. The freight train maintains its structure while having additional data. All the nodes ahead of the new data are moved up one space and the head (the locomotive) is moved to the new front position. The nodes behind the new data are moved back one space and the end is moved back similarly. The scenario is similar for the opposite situation if you were to remove a node.

    A slog entry that I found helpful was http://148blog1.blogspot.ca/2015/03/linked-lists.html. This slog had succinct bite sized bits of info as to what linked lists are capable of, why they're useful and how to write them. A crucial point to take from it is to create a diagram (which is already very emphasized in the entry). It really helps to stimulate how you think about how a linked list functions and how it reacts when manipulated.

No comments:

Post a Comment