SlideShare uma empresa Scribd logo
1 de 58
[object Object],[object Object],[object Object],Linked List 10 20 30 10 NULL Node A Node B Node C Node D P
[object Object],[object Object],[object Object],Node DATA POINTER 10 NODE
Declarations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Structure
ADD ,[object Object],[object Object],[object Object],[object Object],[object Object]
If list is empty i.e. P==NULL ,[object Object],[object Object],P Q NULL
If list is empty i.e. P==NULL P Q NULL
If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node))
If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node)) P->data=num 10
If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node)) P->data=num 10 P->link=NULL NULL
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],true
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],false
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C P Q ,[object Object],[object Object],[object Object],[object Object],10 Node D NULL
DISPLAY ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
If list is empty P Q NULL ,[object Object],[object Object],[object Object],[object Object]
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],true o/p : 10 o/p : 20
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],o/p : 10 o/p : 20 o/p : 30
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B NULL Node C P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],false o/p : 10 o/p : 20 o/p : 30
INSERT ,[object Object],[object Object]
If position is 1 10 20 30 Node A Node B Node C NULL Q P
If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node));
If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node)); p->data=num 5
If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node)); p->data=num; 5 p->link=q;
If position is greater than 1 10 20 30 Node A Node B Node C NULL Q P Suppose a node is to be inserted at position 3.
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; }
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node));
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node)); 25 q->link->data=num;
10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node)); 25 q->link->data=num; q->link->link=temp;
COUNT ,[object Object],[object Object],[object Object]
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],true counter= 1 counter=2
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],counter=1 counter=2 counter=3
If list is not empty i.e. p!=NULL 10 20 30 Node A Node B NULL Node C P Q ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],false counter=3 counter=1 counter=2
REVERSE ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SEARCH ,[object Object],[object Object],[object Object],[object Object]
SEARCH ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10 20 30 Node A Node B Node C P Q 40 NULL Node D position=1 position=2 position=3 position=4
SEARCH ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10 20 30 Node A Node B Node C P Q 40 NULL Node D true position=1 position=2 position=3 position=4
REMOVE ,[object Object],[object Object]
If position is 1 10 20 30 10 NULL Node A Node B Node C Node D P Q
If position is 1 10 20 30 10 NULL Node A Node B Node C Node D P Q ,[object Object]
If position is 1 10 20 30 10 NULL Node A Node B Node C Node D P Q
If position is 1 20 30 10 NULL Node B Node C Node D P Q ,[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],10 20 30 Node A Node B Node C P Q 40 NULL Node D
[object Object],[object Object],[object Object],[object Object],[object Object],10 20 30 Node A Node B Node C P Q 40 NULL Node D
[object Object],[object Object],[object Object],[object Object],[object Object],10 20 30 Node A Node B Node C P Q 40 NULL Node D q->link=q->link->link;
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 7 6 3 Node A Node B Node C 1 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 7 6 3 Node A Node B Node C 1 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 6 7 3 Node A Node B Node C 1 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 3 7 6 Node A Node B Node C 1 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 3 7 6 Node A Node B Node C 1 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 1 7 6 Node A Node B Node C 3 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 1 6 7 Node A Node B Node C 3 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 1 3 7 Node A Node B Node C 6 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 1 3 7 Node A Node B Node C 6 NULL Node D i j
SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link)   {   if(i->data>j->data)   {   temp=i->data;   i->data=j->data;   j->data=temp;   }   } } 1 3 6 Node A Node B Node C 7 NULL Node D i j
Presented by ,[object Object]

Mais conteúdo relacionado

Mais procurados

Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsMohamed Loey
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked ListSayantan Sur
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structureSajid Marwat
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary searchZia Ush Shamszaman
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm03446940736
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListManishPrajapati78
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]Muhammad Hammad Waseem
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Treekhabbab_h
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stackvaibhav2910
 
Circular linked list
Circular linked listCircular linked list
Circular linked listchauhankapil
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)Elavarasi K
 

Mais procurados (20)

Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Linked list
Linked listLinked list
Linked list
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Trees
TreesTrees
Trees
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Tree
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Linked list
Linked listLinked list
Linked list
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Linked list
Linked listLinked list
Linked list
 

Destaque

DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structureTushar Aneyrao
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked listFahd Allebdi
 
Single linked list
Single linked listSingle linked list
Single linked listSayantan Sur
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)swajahatr
 
Circular linked list
Circular linked listCircular linked list
Circular linked listdchuynh
 
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedListLinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedListMarcus Biel
 
Link list CSE ( Data structure ) .
Link list CSE  ( Data structure ) .Link list CSE  ( Data structure ) .
Link list CSE ( Data structure ) .Nirjhor003
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))Papu Kumar
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversionRashmiranja625
 

Destaque (20)

Link List
Link ListLink List
Link List
 
linked list
linked list linked list
linked list
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structure
 
Linked lists
Linked listsLinked lists
Linked lists
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Singly link list
Singly link listSingly link list
Singly link list
 
Single linked list
Single linked listSingle linked list
Single linked list
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
Infix to postfix
Infix to postfixInfix to postfix
Infix to postfix
 
Linked List
Linked ListLinked List
Linked List
 
Infix to postfix conversion
Infix to postfix conversionInfix to postfix conversion
Infix to postfix conversion
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Linkedlist1
Linkedlist1Linkedlist1
Linkedlist1
 
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedListLinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
 
Link list CSE ( Data structure ) .
Link list CSE  ( Data structure ) .Link list CSE  ( Data structure ) .
Link list CSE ( Data structure ) .
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))
 
2CPP17 - File IO
2CPP17 - File IO2CPP17 - File IO
2CPP17 - File IO
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversion
 
Lec5
Lec5Lec5
Lec5
 

Semelhante a Single linked list

–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdfpasqualealvarez467
 
I am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdfI am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdffantoosh1
 
Linked List Implementation of Queue in C
Linked List Implementation of Queue in CLinked List Implementation of Queue in C
Linked List Implementation of Queue in CKasun Ranga Wijeweera
 
Linked lists - Exercises
Linked lists - ExercisesLinked lists - Exercises
Linked lists - ExercisesEleonora Ciceri
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklistritu1806
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribdAmit Kapoor
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 
Please solve the TODO parts of the following probelm incl.pdf
Please solve the TODO parts of the following probelm  incl.pdfPlease solve the TODO parts of the following probelm  incl.pdf
Please solve the TODO parts of the following probelm incl.pdfaggarwalopticalsco
 
Effective C#
Effective C#Effective C#
Effective C#lantoli
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklistilsamaryum
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdfanupambedcovers
 
Write code in c++ Program to a topological sort on a graph Program pl.docx
Write code in c++ Program to a topological sort on a graph  Program pl.docxWrite code in c++ Program to a topological sort on a graph  Program pl.docx
Write code in c++ Program to a topological sort on a graph Program pl.docxnoreendchesterton753
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptkinan keshkeh
 

Semelhante a Single linked list (20)

–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
 
I am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdfI am not able to complete the last function. Could anyone please hel.pdf
I am not able to complete the last function. Could anyone please hel.pdf
 
Linked List Implementation of Queue in C
Linked List Implementation of Queue in CLinked List Implementation of Queue in C
Linked List Implementation of Queue in C
 
Linked lists - Exercises
Linked lists - ExercisesLinked lists - Exercises
Linked lists - Exercises
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Linked lists
Linked listsLinked lists
Linked lists
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribd
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
C programming
C programmingC programming
C programming
 
Please solve the TODO parts of the following probelm incl.pdf
Please solve the TODO parts of the following probelm  incl.pdfPlease solve the TODO parts of the following probelm  incl.pdf
Please solve the TODO parts of the following probelm incl.pdf
 
Effective C#
Effective C#Effective C#
Effective C#
 
Dsprograms(2nd cse)
Dsprograms(2nd cse)Dsprograms(2nd cse)
Dsprograms(2nd cse)
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklist
 
C++ Program to Implement Singly Linked List #includei.pdf
  C++ Program to Implement Singly Linked List  #includei.pdf  C++ Program to Implement Singly Linked List  #includei.pdf
C++ Program to Implement Singly Linked List #includei.pdf
 
Nbvtalkatbzaonencryptionpuzzles
NbvtalkatbzaonencryptionpuzzlesNbvtalkatbzaonencryptionpuzzles
Nbvtalkatbzaonencryptionpuzzles
 
Nbvtalkatbzaonencryptionpuzzles
NbvtalkatbzaonencryptionpuzzlesNbvtalkatbzaonencryptionpuzzles
Nbvtalkatbzaonencryptionpuzzles
 
Write code in c++ Program to a topological sort on a graph Program pl.docx
Write code in c++ Program to a topological sort on a graph  Program pl.docxWrite code in c++ Program to a topological sort on a graph  Program pl.docx
Write code in c++ Program to a topological sort on a graph Program pl.docx
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
 
Pointers
PointersPointers
Pointers
 

Último

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 

Último (20)

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 

Single linked list

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. If list is empty i.e. P==NULL P Q NULL
  • 8. If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node))
  • 9. If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node)) P->data=num 10
  • 10. If list is empty i.e. P==NULL P Q p=(struct node *) malloc(sizeof(struct node)) P->data=num 10 P->link=NULL NULL
  • 11. If list is not empty i.e. p!=NULL 10 20 30 Node A Node B Node C NULL P Q
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. If position is 1 10 20 30 Node A Node B Node C NULL Q P
  • 22. If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node));
  • 23. If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node)); p->data=num 5
  • 24. If position is 1 10 20 30 Node A Node B Node C NULL Q P p=(struct node *) malloc(sizeof(struct node)); p->data=num; 5 p->link=q;
  • 25. If position is greater than 1 10 20 30 Node A Node B Node C NULL Q P Suppose a node is to be inserted at position 3.
  • 26. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; }
  • 27. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp
  • 28. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp
  • 29. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node));
  • 30. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node)); 25 q->link->data=num;
  • 31. 10 20 30 Node A Node B Node C NULL P Q for(i=1;i<=3-2;i++) { q=q->link; } temp Node BC q->link=(struct node *) malloc(sizeof(struct node)); 25 q->link->data=num; q->link->link=temp;
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. If position is 1 10 20 30 10 NULL Node A Node B Node C Node D P Q
  • 42.
  • 43. If position is 1 10 20 30 10 NULL Node A Node B Node C Node D P Q
  • 44.
  • 45.
  • 46.
  • 47.
  • 48. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 7 6 3 Node A Node B Node C 1 NULL Node D i j
  • 49. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 7 6 3 Node A Node B Node C 1 NULL Node D i j
  • 50. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 6 7 3 Node A Node B Node C 1 NULL Node D i j
  • 51. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 3 7 6 Node A Node B Node C 1 NULL Node D i j
  • 52. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 3 7 6 Node A Node B Node C 1 NULL Node D i j
  • 53. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 1 7 6 Node A Node B Node C 3 NULL Node D i j
  • 54. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 1 6 7 Node A Node B Node C 3 NULL Node D i j
  • 55. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 1 3 7 Node A Node B Node C 6 NULL Node D i j
  • 56. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 1 3 7 Node A Node B Node C 6 NULL Node D i j
  • 57. SORTING Traversal & comparison: for(i=p;i!=NULL;i=i->link) { for(j=i->link;j!=NULL;j=j->link) { if(i->data>j->data) { temp=i->data; i->data=j->data; j->data=temp; } } } 1 3 6 Node A Node B Node C 7 NULL Node D i j
  • 58.