Matrix

Saturday, 7 March 2015

Week 8: Strikes, LinkedLists, and Mutating

This week did not have a lab due to the unfortunate timing of the TA strike. Nonetheless, I worked on the lab at home and went to the lectures. Without the help from the TAs and the lab environment, the concepts taught this week were obviously more difficult to understand. The central focus of this week was linked lists, how to manipulate them, and how to traverse through them.

Basic structure of the linked list

Linked lists are essentially a linear sequence of nodes. A linked list can be seen in two ways but the way we focused on during lecture was viewing it as a sequence of nodes, each with a value and a reference to the next node. The primary benefit of using linked lists is that it allows you to easily insert or remove list elements without shifting the whole structure. Values can be added or removed at any point in the list.

We also took a quick look at some pseudo code to help understand how moving through a linked list works. We also took a look at mutating linked lists. Mutability of lists is something we explored in CSC108 where the contents of the list can be changed. Our professor explained the basic concept and will expand more about mutability into trees and such in the coming weeks.

Not this kind of mutating
Overall, this week was not very hard to learn and understand. The tricky part was obviously tackling the lab by myself but I managed to figure it out at the end. Linked lists are an important concept to learn because it seems like a very efficient way to add/delete instances of list elements. This seems useful in real life computing where time predictability is important. It also seems to leave more room to grow as you don't necessarily need to define the size of the list from the get go. Compare this to something like an array where you need to re-declare and copy the elements if the array gets to big, and it becomes a very useful tool in saving time. Hopefully the strike doesn't last too long and we can get back to learning in the labs as well.

1 comment:

  1. I agree that the lab was pretty difficult to understand, it definitely would have helped to have help on it. I hope it did not hurt your grade to much in the end.

    ReplyDelete

Matrix