Hi everybody! In this week’s entry, Linked Lists will be
discussed.
A linked list is linear sequence of nodes, with the first
node being referred to as the front or head of the sequence, and the back or
last node being referred to as the tail of sequence. A linked list may
essentially be seen as a sequence of nodes, each containing value and a
reference to the next node. In our lectures, we used the LLNode class to define
a node and the LinkedList class as a wrapper class to represent the linked list
as a whole.
Traversing a linked list is very different from traversing Trees. A common algorithm, as discussed in class is that of setting a reference to the front of the list and then using a while loop to come to the node desired. At every step of the while loop, the subsequent node is referenced to.
One of the harder concepts discussed in class, was the concept of mutating a linked list. I found it especially hard to mutate list when we had to ‘walk’ the linked list with two references. This traversal method was demonstrated using the example of the ‘prepend’ method. I have found it this concept to become much clearer when I tried out the lab exercises for this week. It is quite a hurdle to get our concepts cleared out with the TA strikes but I have found discussing with friends and office hours to be useful.
Traversing a linked list is very different from traversing Trees. A common algorithm, as discussed in class is that of setting a reference to the front of the list and then using a while loop to come to the node desired. At every step of the while loop, the subsequent node is referenced to.
One of the harder concepts discussed in class, was the concept of mutating a linked list. I found it especially hard to mutate list when we had to ‘walk’ the linked list with two references. This traversal method was demonstrated using the example of the ‘prepend’ method. I have found it this concept to become much clearer when I tried out the lab exercises for this week. It is quite a hurdle to get our concepts cleared out with the TA strikes but I have found discussing with friends and office hours to be useful.
That is all for this week, I hope everyone is having a great
week. Please check out the linked blogs and leave a comment! Thank you!
http://2015csc148slog.blogspot.ca/
No comments:
Post a Comment