Although the linked list is called as a list, it is not a real list as what we have learned before. What I think that a list should looks like is it should be with two square brackets. However, we can still view linked list as a special list without any square brackets. The linked lists are lists made up of an item(or value) and a sub-list, this sub-list is also a linked list which is made up of its own value and a sub-sublist and so on. In addition, we can view linked lists as a node with a value and a reference to other objects which may also be a node of linked list.
A linked list is a linear sequence of nodes. However, in this case, we pick the second idea of linked list. So we defined two class to build a wrapper class of a LLNode class and a LinkedList class. In order to track and view linked list well, we keep a reference to the front (we may called self.front in LLNode)of a sequence. We call the tail item of a linked list back.
In Linkedlist, we may need to make some changes of items in LLNode. That's to say, we will walk along a list. To find what we are looking for and make change of it, we are required to record previous part and current part of node which means waling along a list with two references.


No comments:
Post a Comment