Saturday, 14 March 2015
Impressions on Linked Data Types (Week 9 SLOG)
Unfortunately, due to the T.A. strike, we had no labs this week, so I had less help than normal with understanding linked lists. However, I still had the chance to go over the lab handout and work on the problems a bit by myself. The idea of a "wrapper" was new and caused some trouble initially. It seemed normal to make a separate class to hold all the linked lists elements, but I found it odd that the wrapper only had variables that referenced the front and back of a linked list. This initially caused me confusion when doing certain tasks such as finding whether a linked list contains a specific object, as I would not know how to access those LLNodes between the front and the back nodes. To solve this problem, I would have to "walk the list," as Heap mentioned; that is, to make reference to the front node, and while a certain condition is satisfied, have that node reference the next one instead. We also worked with mutating a linked list structure, in which the order of actions is very important. In the append example, we were shown that we must change the last values nxt variable first, and then add a node as the back, otherwise we lose the old back node. These linked lists were new to me and I will most likely need to revisit them and tinker with the code once things get settled down over the next few weeks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment