Wednesday, 6 April 2016

Week 11

     Personally I actually find linked lists kind of confusing. On the second midterm test, there was one question where a class was given, but it wasn't clear whether it was a class of a linked list, or a class of linked nodes, and I think I lost some marks on that question because of that.
     When we are dealing with linked list and linked nodes, we really have to think hard about it first, because it has many cases, where it might be the first one of the list or the last one of the list. I found out that when writing a function of linked list, it usually involves a base case, a case where the node is the first one in the list (linkedlist.front), a case where the node is somewhere in the middle of the linked list, and a case where the node is the last one in the list (linkedlist.end). And one important thing while writting about linked lists is that you have to change the attribute -size of the linked list when ever you add or delete a node from the list, sometimes I just forget that. I also found when we call linkednode.next, or linkednode.next.next sometimes confusing, and I really have to stop for a sec to think about it which node is it, but it really got better as I practice more and more on this.

No comments:

Post a Comment