Friday, February 5, 2016
Week 4 SLOG
The main concept of week 4 was linked lists. Linked lists consist of nodes that are made up of the data value and its successor next_. The common pattern in linked lists was the method of making a reference to a node, usually called current_node, to move along the entire linked list. However, the most confusing part that I had trouble with was writing the code for def _getitem_. If an item is found, then it is not necessary to move further along the list. Using a flag to keep track if the item has been found was at first very hard to grasp. When appending and prepending to the list, I constantly forgot to check self.back and self.front. In addition, using "assert" to raise an error was very confusing. However, drawing pictures to simulate the situation helped in understanding how the function works and solving the confusion.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment