Because it is reading week this week, we did not have class and I then have time to review the concept of linked list. Linked List is a data structure consisting of a group of nodes which together represent a sequence. Thus, each element in the Linked Lists is actually a LinkedListNode. Under the simplest form, each node is composed of data and a reference (in other words, a link) to the next node in the sequence. One of the advantages of this structure is that it allows for efficient insertion or removal of elements from any position in the sequence. However, when I try to write methods for this structure, the TA told us that the nodes in a linked list must be read in order from the beginning as linked lists are sequential access. Thus, we need to remember this algorithm when writing its methods. Here is an example of a Linked List and we can see that the whole list is connected.
When I did the exercise of writing LinkedList method, I find that there are 5 basic methods of a LinkedList structure: append, prepend, contain, delete, get item. We can also write other methods in the future to expand its function. During the reading week, I review these concepts and find that I understand more about them and we need to review more often in the future.
No comments:
Post a Comment