SlideShare a Scribd company logo
1 of 24
Linked list
Definition
• A linked list is a linear collection of data element.
• These data elements are called nodes, and they point to the next
node by means of pointer.
• A linked list is a data structure which can be used to implement other
data structures such as stack, queues trees and so on.
• A linked list is a sequence of nodes in which each node contains data
field and pointer which points to the next node.
• Linked list are dynamic in nature that is memory is allocated as and
when required.
• Linked list
• Each node is divided into two parts
• The first part contains the information /data.
• The second part contains the address of the next node.
• The last node will not have any next node connected to it, so it will be
store a special value called Null. The Null pointer represents the end
of the linked list.
• Start pointer represent the beginning of the linked list.
• If Start=Null then It means that the linked list is empty.
• The self referential structure in a link list is as follows:
Advantages and disadvantages
• Advantages of linked list
• Linked list are dynamic data structure; that is, they can grow or
shrink during the execution of the program.
• Linked list have efficient memory utilisation. Memory is allocated
whenever it is required and it is de-allocated whenever it is no longer
needed.
• Insertion and deletion is easier and efficient.
• Many complex applications can be easily carried out with the linked
lists.
• Disadvantages of linked list
• They consume more space because every node requires an additional
pointer to store the address of the next node.
• Searching a particular element is the list is difficult and time
consuming.
Types of linked lists
• Singly linked list
• Circular linked list
• Doubly linked list
• Header linked list
Array Vs Linked list
• Array
• Memory Requirement is less in array
• Insertion and deletion
Singly linked list
• A Singly linked list is the simplest type of linked list in which each
node contains some information/data and only one pointer which
points to the next node in the linked list. The traversal of data
element in a single a linked list can be done only in one way.
Circular linked lists
• Circular linked lists are a type of singly linked list in which the address
part of the last node will store the address of the first node, unlike in
singly linked list in which the address part of the last node stores a
unique value Null.
• While traversing a circular linked list we can begin from any node,
because a circular linked list does not have a first or last node.
Doubly linked list
• Doubly linked list is also called a two way linked list, it is a special type
of linked list which can point to the next node as well as the previous
node in the sequence.
• In a doubly linked list each node is divided into three parts:
• the first part is called the previous pointer, which contains the
address of the previous node in the list.
• The second part is called the information part, which contains the
information of the node.
• The third part is called the next pointer, which contains the address
of the succeeding node in the list.
Header linked lists
• Header linked list are a special type of linked list which always contain
a special node, called the header node, at the beginning.
• This header node usually contains vital information about the linked
list, like the total number of nodes in the list, whether the list is
sorted or not and so on. There are two types of header linked lists,
which includes:
• Grounded header linked list
• Circular Header linked list.
Applications of linked list
• Polynomial manipulation representation
• Addition of long positive integers
• Representation of sparse matrix
• Linked application of Files
Algorithm for traversing a linked list
• Step 1: set PTR = Start
• Step 2: Repeat steps 3 & 4 while PTR != NULL
• Step 3 : Print PTR —>INFO
• Step 4: set PTR= PTR—> NEXT
• [end of loop]
• Step 5: exit
Algorithm to search a value in a linked list
• Step 1: Set PTR=Start
• Step 2: Repeat step3 while PTR !=NULL
• Step 3: If Search_Val =PTR—>INFO
• Set POS=PTR
• Print successful search
• Go to step 5
• [end of if]
• Else
• Set PTR=PTR NEXT
• [end of loop]
• Step 4: print unsuccessful search
• Step 5: exit
• Example
Algorithm for inserting a new node in the
beginning of a linked list
• Step 1: Start
• Step 2: IF PTR=NULL
• print overflow
• Go to step 8
• [end of IF]
• Step 3: Set NEW NODE=PTR
• Step 4: set PTR=PTR—>NEXT
• Step 5: set NEW NODE—>INFO =Value
• Step 6: Set NEW NODE—>NEXT=START
• Step 7: Set START =NEW NODE
• Step 8:exit
*/single link list*/
• #include<stdio.h>
• #include<stdlib.h>
• struct node
• {Int data;
• struct node* link;
• };
• struct node *root=NULL;
• void main()
• { Int ch;
• while(1)
• { printf(‘single linked list operations: n”);
• Printf(“1.appendn”);
• Printf(‘2 addaftern”);
• Printf(“enter your choice :”);
• Scanf(“%d”,&ch);
• Switch(ch)
• {case 1:append();
• Break;
• }
• }
• Void append()
• { struct node *temp;
• temp=(struct node*)malloc(sizeof(struct node));
• Printf(“enter node data : “);
• Scanf(“%d”, &temp—>data);
• temp—->link=NULL;
• If(root==NULL)
• { root=temp;
• }
• else
• { Struct node *p;
• p=root;
• While(p—>link!=Null)
• {p=p—>link;
• }
• p->link=temp;
• }
• }
Applications of Arrays
• Arrays are very useful in storing the data in continuous memory
locations.
• Arrays are used for implementing various other data structures such
as stacks,queues etc.
• Arrays are very useful as we can perform various operation on them.

More Related Content

What's hot

Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.pptTirthika Bandi
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESSowmya Jyothi
 
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
 
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 treeArunaP47
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSGokul Hari
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structuresDurgaDeviCbit
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queueSrajan Shukla
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListManishPrajapati78
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Array operations
Array operationsArray operations
Array operationsZAFAR444
 

What's hot (20)

Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN 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
 
sorting and its types
sorting and its typessorting and its types
sorting and its types
 
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
 
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
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Linked list
Linked list Linked list
Linked list
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 
Priority queues
Priority queuesPriority queues
Priority queues
 
Linked list
Linked listLinked list
Linked list
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptxThreaded Binary Tree.pptx
Threaded Binary Tree.pptx
 
Expression trees
Expression treesExpression trees
Expression trees
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Array operations
Array operationsArray operations
Array operations
 

Similar to Linked List

DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxSKUP1
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxLECO9
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxjotaro11
 
Linked list using Dynamic Memory Allocation
Linked list using Dynamic Memory AllocationLinked list using Dynamic Memory Allocation
Linked list using Dynamic Memory Allocationkiran Patel
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxMuwaffiqa
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueSelvaraj Seerangan
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxMeghaKulkarni27
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxRameshaFernando2
 

Similar to Linked List (20)

DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
 
Linked list
Linked listLinked list
Linked list
 
ds bridge.pptx
ds bridge.pptxds bridge.pptx
ds bridge.pptx
 
2- link-list.ppt
2- link-list.ppt2- link-list.ppt
2- link-list.ppt
 
Linked list
Linked listLinked list
Linked list
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptx
 
Linked list using Dynamic Memory Allocation
Linked list using Dynamic Memory AllocationLinked list using Dynamic Memory Allocation
Linked list using Dynamic Memory Allocation
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptx
 
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and Queue
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Link list assi
Link list assiLink list assi
Link list assi
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptx
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptx
 
Linked list
Linked listLinked list
Linked list
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
 

More from RaaviKapoor

CENSORSHIP OF MEDIA : PROS & CONS
CENSORSHIP OF MEDIA : PROS & CONSCENSORSHIP OF MEDIA : PROS & CONS
CENSORSHIP OF MEDIA : PROS & CONSRaaviKapoor
 
B tree ,B plus and graph
B tree ,B plus and graph B tree ,B plus and graph
B tree ,B plus and graph RaaviKapoor
 
PARTIES AND THE PARTY SYSTEM IN INDIA
PARTIES AND THE PARTY SYSTEM IN INDIAPARTIES AND THE PARTY SYSTEM IN INDIA
PARTIES AND THE PARTY SYSTEM IN INDIARaaviKapoor
 
Era of one party dominance
Era of one party dominanceEra of one party dominance
Era of one party dominanceRaaviKapoor
 
Politics of planned development
Politics of planned developmentPolitics of planned development
Politics of planned developmentRaaviKapoor
 
Plant Presentation
Plant PresentationPlant Presentation
Plant PresentationRaaviKapoor
 
Binary Search Tree.pptx
Binary Search Tree.pptxBinary Search Tree.pptx
Binary Search Tree.pptxRaaviKapoor
 
Instruction Formats
Instruction FormatsInstruction Formats
Instruction FormatsRaaviKapoor
 

More from RaaviKapoor (10)

CENSORSHIP OF MEDIA : PROS & CONS
CENSORSHIP OF MEDIA : PROS & CONSCENSORSHIP OF MEDIA : PROS & CONS
CENSORSHIP OF MEDIA : PROS & CONS
 
B tree ,B plus and graph
B tree ,B plus and graph B tree ,B plus and graph
B tree ,B plus and graph
 
PARTIES AND THE PARTY SYSTEM IN INDIA
PARTIES AND THE PARTY SYSTEM IN INDIAPARTIES AND THE PARTY SYSTEM IN INDIA
PARTIES AND THE PARTY SYSTEM IN INDIA
 
Era of one party dominance
Era of one party dominanceEra of one party dominance
Era of one party dominance
 
Politics of planned development
Politics of planned developmentPolitics of planned development
Politics of planned development
 
Plant Presentation
Plant PresentationPlant Presentation
Plant Presentation
 
Binary Search Tree.pptx
Binary Search Tree.pptxBinary Search Tree.pptx
Binary Search Tree.pptx
 
Acid Rain
Acid RainAcid Rain
Acid Rain
 
Instruction Formats
Instruction FormatsInstruction Formats
Instruction Formats
 
IT.pptx
IT.pptxIT.pptx
IT.pptx
 

Recently uploaded

Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

Linked List

  • 2. Definition • A linked list is a linear collection of data element. • These data elements are called nodes, and they point to the next node by means of pointer. • A linked list is a data structure which can be used to implement other data structures such as stack, queues trees and so on. • A linked list is a sequence of nodes in which each node contains data field and pointer which points to the next node. • Linked list are dynamic in nature that is memory is allocated as and when required.
  • 4. • Each node is divided into two parts • The first part contains the information /data. • The second part contains the address of the next node. • The last node will not have any next node connected to it, so it will be store a special value called Null. The Null pointer represents the end of the linked list. • Start pointer represent the beginning of the linked list. • If Start=Null then It means that the linked list is empty.
  • 5. • The self referential structure in a link list is as follows:
  • 6. Advantages and disadvantages • Advantages of linked list • Linked list are dynamic data structure; that is, they can grow or shrink during the execution of the program. • Linked list have efficient memory utilisation. Memory is allocated whenever it is required and it is de-allocated whenever it is no longer needed. • Insertion and deletion is easier and efficient. • Many complex applications can be easily carried out with the linked lists.
  • 7. • Disadvantages of linked list • They consume more space because every node requires an additional pointer to store the address of the next node. • Searching a particular element is the list is difficult and time consuming.
  • 8. Types of linked lists • Singly linked list • Circular linked list • Doubly linked list • Header linked list
  • 9. Array Vs Linked list • Array
  • 10. • Memory Requirement is less in array
  • 11. • Insertion and deletion
  • 12. Singly linked list • A Singly linked list is the simplest type of linked list in which each node contains some information/data and only one pointer which points to the next node in the linked list. The traversal of data element in a single a linked list can be done only in one way.
  • 13. Circular linked lists • Circular linked lists are a type of singly linked list in which the address part of the last node will store the address of the first node, unlike in singly linked list in which the address part of the last node stores a unique value Null. • While traversing a circular linked list we can begin from any node, because a circular linked list does not have a first or last node.
  • 14. Doubly linked list • Doubly linked list is also called a two way linked list, it is a special type of linked list which can point to the next node as well as the previous node in the sequence. • In a doubly linked list each node is divided into three parts: • the first part is called the previous pointer, which contains the address of the previous node in the list. • The second part is called the information part, which contains the information of the node. • The third part is called the next pointer, which contains the address of the succeeding node in the list.
  • 15.
  • 16. Header linked lists • Header linked list are a special type of linked list which always contain a special node, called the header node, at the beginning. • This header node usually contains vital information about the linked list, like the total number of nodes in the list, whether the list is sorted or not and so on. There are two types of header linked lists, which includes: • Grounded header linked list • Circular Header linked list.
  • 17. Applications of linked list • Polynomial manipulation representation • Addition of long positive integers • Representation of sparse matrix • Linked application of Files
  • 18. Algorithm for traversing a linked list • Step 1: set PTR = Start • Step 2: Repeat steps 3 & 4 while PTR != NULL • Step 3 : Print PTR —>INFO • Step 4: set PTR= PTR—> NEXT • [end of loop] • Step 5: exit
  • 19. Algorithm to search a value in a linked list • Step 1: Set PTR=Start • Step 2: Repeat step3 while PTR !=NULL • Step 3: If Search_Val =PTR—>INFO • Set POS=PTR • Print successful search • Go to step 5 • [end of if] • Else • Set PTR=PTR NEXT • [end of loop] • Step 4: print unsuccessful search • Step 5: exit
  • 21. Algorithm for inserting a new node in the beginning of a linked list • Step 1: Start • Step 2: IF PTR=NULL • print overflow • Go to step 8 • [end of IF] • Step 3: Set NEW NODE=PTR • Step 4: set PTR=PTR—>NEXT • Step 5: set NEW NODE—>INFO =Value • Step 6: Set NEW NODE—>NEXT=START • Step 7: Set START =NEW NODE • Step 8:exit
  • 22. */single link list*/ • #include<stdio.h> • #include<stdlib.h> • struct node • {Int data; • struct node* link; • }; • struct node *root=NULL; • void main() • { Int ch; • while(1) • { printf(‘single linked list operations: n”); • Printf(“1.appendn”); • Printf(‘2 addaftern”); • Printf(“enter your choice :”); • Scanf(“%d”,&ch); • Switch(ch) • {case 1:append(); • Break; • } • }
  • 23. • Void append() • { struct node *temp; • temp=(struct node*)malloc(sizeof(struct node)); • Printf(“enter node data : “); • Scanf(“%d”, &temp—>data); • temp—->link=NULL; • If(root==NULL) • { root=temp; • } • else • { Struct node *p; • p=root; • While(p—>link!=Null) • {p=p—>link; • } • p->link=temp; • } • }
  • 24. Applications of Arrays • Arrays are very useful in storing the data in continuous memory locations. • Arrays are used for implementing various other data structures such as stacks,queues etc. • Arrays are very useful as we can perform various operation on them.