Sunday, March 9, 2014

LinkedList

This week the professor dived further into the concept of linked list, the concept of linked list is not so difficult after studying recursion and trees for around a month now.  The past week is more so a cumulative review of all we learned rather than introducing new concepts. The objective is to create a different class to represent a linked list, which is similar to a tree except each node only has one children in its list. Following the class design steps, first is to figure out some of the inherent properties that the class should have which would be included in the initialization part. Since Linked List is basically a chain, we would want it to have a head and also a tail which we call rest which consists of the rest of the chain. Now with the basic structure figured out we include the desired methods such as prepend, adding a node to the front of the chain, or decapitate, removing a front node. Then the prof went on to define an alternative version of the LinkedList concept remain the same, but we added new methods that are commonly used in a list such as insertion, deletion at a desired index of the LinkedList. These were achieved through recursion as the functions calls on the function itself until it reaches the bases where it reaches the desired LinkedList position and uses prepend or decapitated depending on the method. This carefully analysis of the LinkedLink reinforces my knowledge on object oritented programing and recursion at the same time allowing me to furthermore review the concepts we've learned, and this will definitely help me in completing assignment two which requires similar manipulation of Trees and recursion.

No comments:

Post a Comment