Linked Lists


A linked lists,is a linear collection of data elements.These data elements are called nodes.Linked lists are data structures which can used be used to implement other data structures.They act as building blocks for other data structure such as stacks,queues,and other variations.A linked list can be perceived as a train or a sequence of nodes in which each node contains one ore more data fields and a pointer to next node.A linked list contains a pointer variable,Start,which stores the address of the first node in the first node in the list The start node will contain the address of the first node,the next part of the node will in turn store the address of its succeeding node.If start=null this means that the linked list is empty and contain no nodes.Linked list using following codestruct

{

int data;

struct node *next;

};

Linked list versus arrays

An array is a collection of data elements and a linked list is a linear collection of nodes.But linked list does not store its nodes in consecutive memory locations.Another point of difference between an array and linked list is that a linked list does not allow random access of data.Nodes in a linked list can be accessed only in sequential manner,but like an array.Another advantages of linked list over an array that we can add any number of element in the list.Linked list provide an efficient way of storing related data and perform basic operation such as insertion,deletion and updating of information at the cost of the extra space required for storing the address of the next node.

Comments