I found the idea of linked list to be a bit more easy to wrap my head around than the trees from the previous weeks. Mainly because it's linear, in the sense that the data do not keep spreading out. The data in a linked list is similar to cargo in a freight train, each node contains some stuff then contains the link to the next node.
When I looked over the code of the already implemented functions in the lab, I noticed that many of them has a similar segment of code which is used to traverse through it. Seeing this, I went back to the lecture slides and found that there was a page on walking through a linked list. I guess I must have missed this slide during class. You walk through a linked list by having a variable cur_node refer to the front. Then in a while loop structure, we do some stuff then set cur_node to cur_node.nxt.
This was the first lab exercise that we didn't get a chance to go into tutorial and get assistance from a TA. Since I didn't have my lab on Thursday this week, I sort of slacked off on the lab exercise. Once I did get to it, I was able to implement a few functions without a problem but then I ran into trouble with insert_before and delete_after. After trying some random stuff, I gave up and looked through the solutions. Although the solutions did help, I felt like I would have understood more if I was able to work through it myself after some feedback. However, I should probably only blame myself since I slacked off this week. I will try harder next week and refrain from blaming the strike for my lowered motivation to do lab work.
No comments:
Post a Comment