Pages

Monday, October 17, 2016

Linked List , Types of linked list and why we use linked list

Linked List


 Definition : It is that type of lenear data structure where    nodes/ item are connected with one another through pointer. Diagrammatically the connection betwwen two nodes is represented by arrows.

 For example 

 the first nodes of the linked list is called head and the last node of the linked list is called 'tail' .

 Types of Linked List :

  There are three types of Linked List.
  
  1. one way linked list: 
  
  It is a linked list where two adjacent nodes are connected by   one pointer ( Represented by single headed arrow).
  
   
   For example 
  

  in one way linked list each nodes is divided into two parts 
  
  a .(info part) 
  b.(Address part)
  
  The info parts contain the actual data/information 
  and the address part of a node contain the address of the next node .
  
  Note :  the address part of the last node does not contain      any address it contains null address
  
  

2 Circular linked list :

 It is a linked list where the last node is connected back to the first node.

The address part of the last node contain the address of the first node.

For example ....




Multiple Linked List : 

   It is that type of linked list where nodes are connected by more than one pointer /Where two adjacent nodes  is connected by two pointer.
 
For example:



 
Here each nodes has three part 
 
 
1 info part : This part contain the actual data/information 

2 left part :this part contain the address of next node

3 Right part :   This part contain the address                  of succeeding (previous) node. 
 
 
 Why we use Linked List
 
 The most important application of linked list is the creation 
  of file on secondary storage device.




Writter/publisher : Shafiq from university of Abdul wali khan Mardan timergara campus

No comments:

Post a Comment