-->

Linked List Brush Up

Posted by Admin on
What is a LinkedList ?
A linked list is simply a chain of structures which contain a pointer to the next element. It is dynamic in nature. Items may be added to it or deleted from it at will. 
This definition applies only to Singly Linked Lists - Doubly Linked Lists and Circular Lists are different.

A list item has a pointer to the next element, or to 0 if the current element is the tail (end of the list). This pointer points to a structure  of the same type as itself. This structure that contains elements and pointers to the next structure is called a Node.

Each node of the list has two elements:

the item being stored in the list and
a pointer to the next item in the list




Some common examples of a linked list:
Hash tables use linked lists for collission resolution
Any "File Requester" dialog uses a linked list
Binary Trees
Stacks and Queues can be implemented with a doubly linked list
Relational Databases (e.g. Microsoft Access)


What are the advantage and disadvantage of linked list ?

Advantages:-
1. Linked List are dynamic data structures :-That is they can grow or shrink during the execution of a program.
2.Efficient memory utilization:-Here,memory is not pre-allocated . Memory is allocated whenever it is required and removed whenever it is no longer needed. and main thing is that linked list node are not stored in contiguous memory allocation hence providing efficiency in memory allocation.
Disadvantages:-
Access to any arbitrary data is a little bit more cumbersome.   




No comments:

Post a Comment