Monday, 9 April 2012

Linked List, Advantages and Disadvantages of linked list


Linked List:-
          A linked list is the chain of nodes or date items connected by pointers and each node contains a pointer pointing to the address of next node or data item. A linked list is an ordered list of data items.
          A link list is a collection of records of the same data type, and all such records are connected through pointers each record in a linked list has a pointer field pointing to the next record in the list. The pointer field in the last record of the list is assigned the null value. A pointer variable is used to point to the first record in the list.


Advantages of linked list:-
  • It is not necessary to know in advance the number of elements to be stored in the list and therefore, need not allocate. d as and when necessary.
  • In a linked list, insertions and deletions can be handled efficiently without fixing the size of the memory in advance.
  • An important advantage of linked lists over arrays is that the linked list uses exactly as much memory as it needs, and can be made to expand to fill all available memory locations if needed.

Disadvantages:-
  • The traversal is sequential.
  • Increased overhead for storing pointers for linking the data items.



2 comments: