Amidst the frenzy of the strike and the mad
dash to hand in our assignment, we learned what linked lists are, yet another
type of data structure. The instructor described linked list structures as
“objects (nodes) with a value and a reference to other similar objects”. I had
no idea what he was talking about at first but then like I did in the past with
object-oriented programming, I thought carefully about the name “linked lists”.
From the term “linked”, I derived the fact that the elements within a linked
list were “linked”, which I think means that each element is aware of the one
succeeding it and can therefore manipulate it somehow. Unlike the Tree and
Binary Tree classes, this data structure requires two classes, an “LLNode”
class and a “LinkedList” class. The LLNode class represents the “node” to be an
element in a linked list. It both keeps track of the data, which can be any
object, of the current node and the next node, which could either be the same
LLNode or None, if the current node is the last of the list. The class
LinkedList is what is known as the “wrapper class” for the LLNode class. Wrapper
classes are called what they are because they “wrap” a data type into an object
for that class. In this case, the LinkedList class has LLNode objects as the
“values” and keeps track of information about the entire list, including the
front and the back of the list, and its size.
While
we used recursion to traverse through trees and binary trees, we only used
iterative methods to work with linked lists. “Walking along” a linked list did
not seem hard to me when the instructor explained it. However, when it came to
changing the nodes’ values or deleting or adding nodes, it was definitely
harder than doing that with any old regular python list, which you can just do
with indexing and aliasing. For me, it was very confusing to keep track of what
the next node was going to be after deleting or adding the node of interest in
the middle of the linked list and then shifting the rest of the nodes forward
or backward. Although the instructor did his best to explain the concepts
behind it all, it was ultimately up to me to apply the tools he gave us. The
lab was quite challenging and while it would have been nice to have TAs’
support, I failed to execute the exercises so I have no excuse for that. I
certainly did pay for it by not performing well in the linked list portion of
the test.
I am finally
starting to understand how to work with trees and binary trees but this linked
list was just another live grenade thrown into the fray. Sometimes I feel that
this course is moving too fast. What I will do to address the issues is to
follow the advice of the instructor, which is to draw diagrams when working on
linked list exercises and spending extra time outside of class to review
concepts introduced in class so that I am prepared to get right into applying
the tools when it comes time to practice. Hopefully the next few weeks these concepts
will come together for me and any others who might be struggling.
I took the time
to look at a few slogs of my classmates this week and I must say my good friend
Christian’s slog (http://christiangarciacsc148.blogspot.ca/)
is quite good. You can tell even by skimming through his entries that he takes
special care by attaching pictures, pasting special pieces of code that are of
interest, and editing his writing to make them more readable, which is
something I must work on. His explanations of concepts are very clear and
concise. His latest entry was also on linked lists and while he and I are
together in terms understanding the basic idea behind linked lists, he does
seem more enthusiastic about learning more about them, which I admire. He also
seems to care more about other people’s slogs, as I have mentioned them once
before, which the good guy here makes sure to give a shout out to his
classmates every week. I will fix that myself in the coming weeks. Overall, his
slog is of high-quality and I might just use his slog when reviewing for the
final exam!
(disclaimer: I wrote during the 9th week but forgot to upload from my word document so I am uploading now during week 10)
No comments:
Post a Comment