Saturday, March 21, 2015

Week 9

This week we studied about linked list. It is a fun topic that is not too hard but definitely not too easy.

Conceptually speaking, linked list is not hard. Every node has a value and a link to the lists ahead of it. The first list is called the front and the last list is called the back. Many operations can be performed with linked list. The most common one is to either add a node to the front or to the back of the list. While adding a node to the front is easy, adding it to the back is relatively more complicated. This is because when we add a node to the back, we not only have to link our back with the new node, but we also have to link the node before our previous back with our previous back. This creates some complexity, and often a while loop is used to solve the problem.

The thing I find with linked list is that the concept is fairly easy, and yet it is extremely prone to mistakes. You can miss the question by simply forgetting to link two nodes together. This nature of linked list should alert us when we solve a linked list question. We must be super careful with our logic and never forget what links with what.

No comments:

Post a Comment