2015年3月26日星期四

Impressions of week 8 (writing for week 9)


  This week we learn a lot about linked list. Linked lists can keep elements in a certain order in a very different style. "A linked list, relies on a more distributed representation in which a lightweight object, known as a node, is allocated for each element. "  I think linked lists are the combination of trees and lists. The main difference between linked lists and trees is that every linked-lists node only have one child that refers to the next node or the tail, resulting in a straight line of data, which looks like a list.

  Important knowledge in week 7






  


  A. Head and Tail

  As we see in the picture above, the first and last node of a linked list are known as the head and tail of the list respectively. Following the each node's next reference, we move from one node to another, starting at the head. Finally we reach the tail of the list. We could say that the tail as the node having None as its next reference.

  


  B. Nodes

  Remember that each node is a unique object.

  C. LLNode Class and LinkedList Class

  It was kind hard for me to understand how those nodes are stored in a "list". Is that really a list or there exists another form. And it was not easy for me to shift or insert nodes. Then I thought it would be easier if I imagined that it is a list and the elements of the list are nodes, however, all of those nodes contain two parts. One part is "themselves" which means the object, such as a number, stored in a instance variable called "element", and the other part is a pointer which refers to the next "element". just forget about the form that they are stored.

  D. The disadvantages and advantages of linked lists

  Elements of a linked list cannot be efficiently accessed by a numeric index and we cannot tell just by examining a node if it is the second, third or something else in the list. However, being different from binary trees, linked list provide us a chance to store a sequence in a specific order.


  Throughout the lecture for this week, we learned how to insert, delete and using recursion with linked lists. I can't wait to learn more practical using of linked lists!

没有评论:

发表评论