LINKED LIST
INTRODUCTION
A linked list is a linear collection of data elements called
nodes.
A node of a linked list is divided into two parts:
 Information part-contains the information part of the element
 Link part-contains address of the next node in the list
Contains a pointer variable START-stores address of 1st
node
HISTORY
Developed in 1955–1956 by Allen Newell, Cliff
Shaw and Herbert A. Simon at Rand Corporation as the
primary data structure for their Information Processing
Language
Problem of machine translation for natural language
processing led Victor Yngve at Massachusetts Institute of
Technology (MIT) to use linked lists as data structures
Several operating systems developed by Technical
Systems Consultants(originally of West Lafayette Indiana,
and later of Chapel Hill, North Carolina) used singly linked
lists as file structures
TYPES
Singly Linked List:- It is a simplest type of linked list
Doubly linked list:- It is a two way linked list
Circular linked list:- Last node contain a pointer to the
first node of the list
ADVANTAGES
Linked lists are a dynamic data structure, allocating the
needed memory while the program is running
Insertion and deletion node operations are easily
implemented in a linked list
Linear data structures such as stacks and queues are easily
executed with a linked list
They can reduce access time and may expand in real time
without memory overhead
DISADVANTAGES
They have a tendency to use more memory due to pointers
requiring extra storage space
Nodes in a linked list must be read in order from the
beginning as linked lists are inherently sequential access
Nodes are stored incontiguously, greatly increasing the time
required to access individual elements within the list
Difficulties arise in linked lists when it comes to reverse
traversing. Singly linked lists are extremely difficult to
navigate backwards, and while doubly linked lists are
somewhat easier to read, memory is wasted in allocating
space for a back pointer.
SINGLY LINKED LIST
Simplest type of linked list
Every node contains some data and a pointer to the next
node of the same datatype
The last node contains the null reference
Operations that can be performed on singly linked lists
include insertion, deletion and traversal.
ALGORITHM OF SINGLY LINKED LIST
If avail:=null then write :-” overflow and exit”.
Else new:=avail.
Avail:=link[avail].
Set info[new]:=data.
Set link[new]:=start.
Start :=new.
Exit.
DOUBLY LINKED LIST
Also called two-way linked list
Contains a pointer to the next as well as previous node in the
sequence
Consists of three parts:-
 Data Part
 Pointer to the next node
 Pointer to the previous node
PREV field of the first node and NEXT field of the last node
contain NULL
ALGORITHM OF DOUBLY LINKED LIST
 If avail:=NULL then write:”overflow and exit”
 Else new:=avail.
 Avail:=link[avail].
 Set prev[new]:=NULL.
 Set info[new]:=data
 Set link[new]:=start.
 Set prev[start]:=new.
 Start :=new
 Exit
CIRCULAR LINKED LIST
Last node contains a pointer to the first node of the list
No NULL value in any of the LINK fields
Operations that can be performed on singly linked lists
include insertion, deletion and traversal.
Traversing possible in any direction-forward or backward,
until we find the LINK field containing the address of the
first node of the list(denoting the end of the linked list)
ALGORITHM CIRCULAR LINKED LIST
 If avail =NULL then write :”overflow and exit”
Else new:=avail
Avail :=Link[avail].
Set info[new]:=value.
Set ptr:=start.
Repeat step 6 while link[ptr]=!=start.
Ptr:=link[ptr].
 (end of loop).
Link[new]:=start.
Link[ptr]:=new.
Start:=new
Exit
THANK YOU

Linked list

  • 1.
  • 2.
    INTRODUCTION A linked listis a linear collection of data elements called nodes. A node of a linked list is divided into two parts:  Information part-contains the information part of the element  Link part-contains address of the next node in the list Contains a pointer variable START-stores address of 1st node
  • 3.
    HISTORY Developed in 1955–1956by Allen Newell, Cliff Shaw and Herbert A. Simon at Rand Corporation as the primary data structure for their Information Processing Language Problem of machine translation for natural language processing led Victor Yngve at Massachusetts Institute of Technology (MIT) to use linked lists as data structures Several operating systems developed by Technical Systems Consultants(originally of West Lafayette Indiana, and later of Chapel Hill, North Carolina) used singly linked lists as file structures
  • 4.
    TYPES Singly Linked List:-It is a simplest type of linked list Doubly linked list:- It is a two way linked list Circular linked list:- Last node contain a pointer to the first node of the list
  • 5.
    ADVANTAGES Linked lists area dynamic data structure, allocating the needed memory while the program is running Insertion and deletion node operations are easily implemented in a linked list Linear data structures such as stacks and queues are easily executed with a linked list They can reduce access time and may expand in real time without memory overhead
  • 6.
    DISADVANTAGES They have atendency to use more memory due to pointers requiring extra storage space Nodes in a linked list must be read in order from the beginning as linked lists are inherently sequential access Nodes are stored incontiguously, greatly increasing the time required to access individual elements within the list Difficulties arise in linked lists when it comes to reverse traversing. Singly linked lists are extremely difficult to navigate backwards, and while doubly linked lists are somewhat easier to read, memory is wasted in allocating space for a back pointer.
  • 7.
    SINGLY LINKED LIST Simplesttype of linked list Every node contains some data and a pointer to the next node of the same datatype The last node contains the null reference Operations that can be performed on singly linked lists include insertion, deletion and traversal.
  • 8.
    ALGORITHM OF SINGLYLINKED LIST If avail:=null then write :-” overflow and exit”. Else new:=avail. Avail:=link[avail]. Set info[new]:=data. Set link[new]:=start. Start :=new. Exit.
  • 9.
    DOUBLY LINKED LIST Alsocalled two-way linked list Contains a pointer to the next as well as previous node in the sequence Consists of three parts:-  Data Part  Pointer to the next node  Pointer to the previous node PREV field of the first node and NEXT field of the last node contain NULL
  • 10.
    ALGORITHM OF DOUBLYLINKED LIST  If avail:=NULL then write:”overflow and exit”  Else new:=avail.  Avail:=link[avail].  Set prev[new]:=NULL.  Set info[new]:=data  Set link[new]:=start.  Set prev[start]:=new.  Start :=new  Exit
  • 11.
    CIRCULAR LINKED LIST Lastnode contains a pointer to the first node of the list No NULL value in any of the LINK fields Operations that can be performed on singly linked lists include insertion, deletion and traversal. Traversing possible in any direction-forward or backward, until we find the LINK field containing the address of the first node of the list(denoting the end of the linked list)
  • 12.
    ALGORITHM CIRCULAR LINKEDLIST  If avail =NULL then write :”overflow and exit” Else new:=avail Avail :=Link[avail]. Set info[new]:=value. Set ptr:=start. Repeat step 6 while link[ptr]=!=start. Ptr:=link[ptr].  (end of loop).
  • 13.
  • 14.