Thursday, March 27, 2014

Week 8 -- linked List

There are two ways to represent linked list. One of which is as lists made up of an item (value) and the remaining list(rest), the other way is as objects (nodes) with a value and a reference to other
similar objects.

For the first type, the class for LinkedList is initialized like this:










And for the second type, a class call LListNode is defined first to represent the objects in the linked list:








Linked list makes each elements related(linked) one by one.













For this example, the nodes will be linked like this:
_images/link2.png

No comments:

Post a Comment