SlideShare a Scribd company logo
ALGORITHM FOR DELETING A NODE
Suppose
• START is the first position in linked list. Let
• VALUE be the element to be deleted.
• TEMP, PTR is a temporary pointer to hold the node address.
17
ALGORITHM FOR DELETING A NODE
// Delete first
node
1.Input the VALUE to be deleted
2.if ((START -> DATA) is equal to
VALUE ) TEMP = START
START = START -> Next
Set free the node TEMP, which is
deleted
Exit
3.PTR = START
4.WHILE (PTR -> DATA !=
VALUE ) TEMP = PTR
PTR = PTR -> Next
5.TEMP -> Next = PTR ->
Next
//Delete the node
6.Set free the node PTR,
which is deleted
18
ALGORITHM FOR DISPLAY ALL NODES
1. If (START is equal to NULL)
(a) Display "The list is Empty"
(b) Exit
2. Initialize TEMP = START
3. Repeat until (TEMP = NULL )
Display "TEMP ->
DATA"
TEMP = TEMP -> Next
6. Exit
19

More Related Content

More from Anil Yadav (20)

Lec-12, 13 Quee s Applications of Queues
Lec-12, 13 Quee s Applications of Queues
Anil Yadav
 
Lec-12, 13 Quees Array Implementation IN
Lec-12, 13 Quees Array Implementation IN
Anil Yadav
 
Lec-12, 13 Quees In Queue IntQueue(int s)
Lec-12, 13 Quees In Queue IntQueue(int s)
Anil Yadav
 
Lec-12, 13 Quees A class for Dynamic Queue implementation
Lec-12, 13 Quees A class for Dynamic Queue implementation
Anil Yadav
 
Function enqueue inserts the value in num
Function enqueue inserts the value in num
Anil Yadav
 
Lec-12, 13 Quees -How to determine empty and full Queues?
Lec-12, 13 Quees -How to determine empty and full Queues?
Anil Yadav
 
Unit2-BIS Business Information system Data
Unit2-BIS Business Information system Data
Anil Yadav
 
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Anil Yadav
 
Lec-12, 13 Quees Another implementation of Queues using Arrays
Lec-12, 13 Quees Another implementation of Queues using Arrays
Anil Yadav
 
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Anil Yadav
 
Lec-32 Recursion - Divide and Conquer in Queue
Lec-32 Recursion - Divide and Conquer in Queue
Anil Yadav
 
Lec-32 Recursion -Recursion in Computer Science
Lec-32 Recursion -Recursion in Computer Science
Anil Yadav
 
Lec-32 What is recursion? A mathematical look
Lec-32 What is recursion? A mathematical look
Anil Yadav
 
The word or can be interpreted in two distinct ways:
The word or can be interpreted in two distinct ways:
Anil Yadav
 
A proposition makes a claim (either an assertion or a denial) that may be eit...
A proposition makes a claim (either an assertion or a denial) that may be eit...
Anil Yadav
 
Lec-23,24 Sets A Bit-Vector Implementation of Sets
Lec-23,24 Sets A Bit-Vector Implementation of Sets
Anil Yadav
 
linked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Lists
Anil Yadav
 
linked-list - Finding a node Deleting a node
linked-list - Finding a node Deleting a node
Anil Yadav
 
Lec-35Graph - Graph - Copy in Data Structure
Lec-35Graph - Graph - Copy in Data Structure
Anil Yadav
 
Lec-35Graph - Copy Graph therory in Data strucure
Lec-35Graph - Copy Graph therory in Data strucure
Anil Yadav
 
Lec-12, 13 Quee s Applications of Queues
Lec-12, 13 Quee s Applications of Queues
Anil Yadav
 
Lec-12, 13 Quees Array Implementation IN
Lec-12, 13 Quees Array Implementation IN
Anil Yadav
 
Lec-12, 13 Quees In Queue IntQueue(int s)
Lec-12, 13 Quees In Queue IntQueue(int s)
Anil Yadav
 
Lec-12, 13 Quees A class for Dynamic Queue implementation
Lec-12, 13 Quees A class for Dynamic Queue implementation
Anil Yadav
 
Function enqueue inserts the value in num
Function enqueue inserts the value in num
Anil Yadav
 
Lec-12, 13 Quees -How to determine empty and full Queues?
Lec-12, 13 Quees -How to determine empty and full Queues?
Anil Yadav
 
Unit2-BIS Business Information system Data
Unit2-BIS Business Information system Data
Anil Yadav
 
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Anil Yadav
 
Lec-12, 13 Quees Another implementation of Queues using Arrays
Lec-12, 13 Quees Another implementation of Queues using Arrays
Anil Yadav
 
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Anil Yadav
 
Lec-32 Recursion - Divide and Conquer in Queue
Lec-32 Recursion - Divide and Conquer in Queue
Anil Yadav
 
Lec-32 Recursion -Recursion in Computer Science
Lec-32 Recursion -Recursion in Computer Science
Anil Yadav
 
Lec-32 What is recursion? A mathematical look
Lec-32 What is recursion? A mathematical look
Anil Yadav
 
The word or can be interpreted in two distinct ways:
The word or can be interpreted in two distinct ways:
Anil Yadav
 
A proposition makes a claim (either an assertion or a denial) that may be eit...
A proposition makes a claim (either an assertion or a denial) that may be eit...
Anil Yadav
 
Lec-23,24 Sets A Bit-Vector Implementation of Sets
Lec-23,24 Sets A Bit-Vector Implementation of Sets
Anil Yadav
 
linked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Lists
Anil Yadav
 
linked-list - Finding a node Deleting a node
linked-list - Finding a node Deleting a node
Anil Yadav
 
Lec-35Graph - Graph - Copy in Data Structure
Lec-35Graph - Graph - Copy in Data Structure
Anil Yadav
 
Lec-35Graph - Copy Graph therory in Data strucure
Lec-35Graph - Copy Graph therory in Data strucure
Anil Yadav
 

Recently uploaded (20)

"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
Ad

Link List & ALGORITHM FOR DELETING A NODE

  • 1. ALGORITHM FOR DELETING A NODE Suppose • START is the first position in linked list. Let • VALUE be the element to be deleted. • TEMP, PTR is a temporary pointer to hold the node address. 17
  • 2. ALGORITHM FOR DELETING A NODE // Delete first node 1.Input the VALUE to be deleted 2.if ((START -> DATA) is equal to VALUE ) TEMP = START START = START -> Next Set free the node TEMP, which is deleted Exit 3.PTR = START 4.WHILE (PTR -> DATA != VALUE ) TEMP = PTR PTR = PTR -> Next 5.TEMP -> Next = PTR -> Next //Delete the node 6.Set free the node PTR, which is deleted 18
  • 3. ALGORITHM FOR DISPLAY ALL NODES 1. If (START is equal to NULL) (a) Display "The list is Empty" (b) Exit 2. Initialize TEMP = START 3. Repeat until (TEMP = NULL ) Display "TEMP -> DATA" TEMP = TEMP -> Next 6. Exit 19