Sunday, 28 August 2011

Linked List


In computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is comprised of a datum and a reference(in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.
                       Singly-linked-list.svg
A linked list whose nodes contain two fields: an integer value 
and a link to the next node. 
                   


In the C language, linked lists combine the concept of an array with structures and pointers. In a way, a linked list is really like an array of structures.But, unlike with an array of structures, you can add and remove structures from the linked list easily.


Linked list can be accessed in a flexible fashion, because each piece of information carries with it a link to the next data item in the chain. In addition, a linked list retrieval operation does not remove and destroy an item from the list. In fact, you need to add a specific deletion operation to do this.

Linked lists can be :


Linear and Circular linked list:  In the last node of a list, the link field often contains a null reference, a special value used to indicate the lack of further nodes. A less common convention is to make it point to the first node of the list; in that case the list is said to be circular or circularly linked; otherwise it is said to be open or linear.


Circularly-linked-list.svg


Singly linked listSingly-linked lists contain nodes which have a data field as well as a next field, which points to the next node in the linked list.

                               Singly-linked-list.svg
                                                
Download Link: 
http://www.fileserve.com/file/dgxgZ4P/Dynamic_representation_of_singly_Linked_list.txt


Doubly linked list: In a doubly linked list, each node contains, besides the next-node link, a second link field pointing to the previous node in the sequence. The two links may be called forward(s) and backwards, or next and previous.


Doubly-linked-list.svg

                                  

No comments:

Post a Comment