Last week the TA's went on strike. Therefore, we didn't have any labs during the week. The lab handout was still available, but there were no lab quizzes, and no one had to show up to their weekly scheduled labs. This meant, that while there were still questions and functions to write and implement, there was no TA to ask for help, when stuck and needing guidance. Beyond this inconvenience, the lecture was understandable and I didn't have any more trouble solving the lab problems. The discussion board was a good place to go, especially this week, when I had trouble with the lab. Also the solutions were posted for the lab, so I had the answers and when stuck I could work back from the solution and understand how they got to that code.
In class, we learned about linked lists. We also learned of two different, but very useful ways to think about linked list structures. The first way to think of them is as lists made up of an item (value) and a sub-list (rest). The second way of thinking about linked lists is as objects (nodes) with a value and a reference to other similar objects. This sounds complex but what it really translates into is a list within a list, or a tree with a branching factor of one, meaning one node points to another, which points to another and so on. Linked lists also need a "wrapper" class. This class represents the linked list as a whole and keeps track of information about the entire list, including its front, back and size. This class initializes these variables as the most basic and simple list (an empty linked list) with size 0, and the front and back both initialized to None.
Furthermore, we learned how to "walk" across a linked list, as in how to write code that can check the nodes of a linked list. In that code, we made a reference (to at least one) other node and then moved the code along the list. We then added and modified to the code so that is checks every possible node in a linked list ( _contains_ ). Afterwards, we wrote code for an append method, which does several things: change the last node, the former last node, the back, the size (adding one as an item is appended to the list), as well as possibly the front. A question concerning linked lists was on Test 2, which we had this week. Understanding and learning how to implement functions for linked lists was something I found slightly difficult for this week. However, by working through the problems in the lab handout and by playing around with the class code, I was able to gain a more thorough understanding of the concept. Programming really is a hands on subject; to learn more efficiently and effectively all you have to do is code more.
No comments:
Post a Comment