This week featured some more linked lists. The idea of a linked list did not stick with me at first, but after drawing pictures and help from the T.A's, it became clearer. We think of a Linked list as a group of nodes which represent a sequence. The following illustration of a linked list shows how it works where the numbers are the values and the second box is the "rest" of the list which is basically a "link" to the rest of the list.
[1][]-->[2][]-->[3][]-->[]
The last empty node being the end of the list. I found the lab for this week much easier than last week as I had a better understanding of the linked list and once my partner and I realized how the getitem method in the linked list file worked, implementing the ones that were asked became an easy task as they were all similar in structure to the __getitem__ method and the way it handles it recursively.
The assignment part 1 involved creating a Regex class which I find acts like the tree class that was given in the notes. The implementation was similar but with the appropriate conditions. I don't feel too confident about what I submitted as it feels too "big" and inefficient and i'm sure there were things that I could have done to shorten the code.
My goal is to once and for all understand fully how to create recursive functions and list comprehension.
No comments:
Post a Comment