SlideShare a Scribd company logo
5
Most read
9
Most read
13
Most read
Deletion from single way
linked list and search
PRESENTED BY:
M D I S L A M K H A N 171-15-9537
A B D U L L A H A L R E D WA N 171-15-9538
A S I Q U R R A H M A N A S I Q 171-15-9528
M O M I N U R I S L A M A S A D 163-15-8523
Linked list
linked list is a linear data structure. It contains
nodes. Each node contains two parts,
i.e. DATA part and LINK part.
 The data contains elements , and
 Link contains address of another node.
WHAT ARE LINKED LISTS
A linked list is a linear data
structure.
Nodes make up linked lists.
Nodes are structures made up of
data and a pointer to another
node.
 Usually the pointer is called
next.
TYPES OF LINKED LISTS
1. Single linked list.
2. Double linked list.
3. Circular linked list.
4. Circular double linked list.
Singly Linked List
 Each node has only one link part.
Each link part contains the address of the next node in
the list.
Link part of the last node contains NULL value which
signifies the end of the node.
BASIC OPERATIONS ON A LIST
 Creating a List
 Inserting an element in a list
 Deleting an element from a list
 Searching a list
 Reversing a list
Deleting a Node in SLL
Here also we have three cases:-
Deleting the first node
Deleting the last node
Deleting the intermediate node
DELETING THE FIRST NODE
Here we apply 2 steps:-
 Making the start pointer point towards the 2nd node.
Deleting the first node using delete keyword.
void delete_from_first()
{
struct node* temp=head;
head=head->next/temp->next;
free(temp);
}
Deleting the last node
Here we apply 2 steps:-
 Making the second last node’s next pointer point to NULL.
 Deleting the last node via delete keyword.
void delete_from_last()
{
struct node *temp=head, *temp2;
while(temp->next)
{
temp2=temp;
temp=temp->next;
}
temp2->next=NULL;
free(temp);
}
Deleting a particular node
Here we make the next pointer of the node previous to the node
being deleted ,point to the successor node of the node to be
deleted and then delete the node using. delete keyword.
void delete_from_any_position(int pos)
{
int i ;
struct node *temp=head, *temp2;
for(i=2 ; i<pos ; i++)
{
temp=temp->next;
}
temp2=temp->next
temp->next=temp2->next;
free(temp2);
}
Searching a SLL
 Searching involves finding the required element in the list.
 We can use various techniques of searching like linear search or
binary search where binary search is more efficient in case of
Arrays.
 But in case of linked list since random access is not available it
would become complex to do binary search in it.
 We can perform simple linear search traversal.
 In linear search each node is traversed till the data in
the node matches with the required value:
void search (int x)
{
node*temp=start;
while(temp!=NULL)
{
if(temp->data==x)
{
cout<<“FOUND ”<<temp->data;
break;
}
temp=temp->next;
}
APPLICATIONS OF LINKED LIST
A linked list is a very efficient data structure for sorted list
that will go through many insertions and deletions.
A linked list is a dynamic data structure in which the list
can start with no nodes and then grow as new nodes are
needed. A node can be easily deleted without moving other
nodes, as would be the case with an array.
For example, a linked list could be used to hold the records
of students in a school. Each quarter or semester , new
students enroll in the school and some students leave or
graduate.
 Advantages of using a Linked list:
Save space (don’t have to worry about sparse polynomials) and
easy to maintain.
 Don’t need to allocate list size and can declare nodes (terms) only
as needed.
Operation related to data elements like insertions or deletion are
more simplified
 Disadvantages of using a Linked list :
 Can’t go backwards through the list.
 Can’t jump to the beginning of the list from the end.
Deletion from single way linked list and search

More Related Content

PPTX
Artificial intelligence
PPTX
Linked List - Insertion & Deletion
PDF
Assembling and disassembling pc. pdf
PPTX
Intel Processors
PPT
Famous scientists
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
Construction and working principle of 1 phase transformer
PPTX
Collections and its types in C# (with examples)
Artificial intelligence
Linked List - Insertion & Deletion
Assembling and disassembling pc. pdf
Intel Processors
Famous scientists
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Construction and working principle of 1 phase transformer
Collections and its types in C# (with examples)

What's hot (20)

PPT
Singly link list
PPTX
PPTX
Doubly Linked List
PPTX
Linked list
PPTX
Queue Implementation Using Array & Linked List
PPTX
Presentation on Function in C Programming
PPTX
single linked list
PPTX
Circular link list.ppt
PDF
03 Linear Arrays Memory Representations .pdf
PPT
Linked List
PPTX
Row major and column major in 2 d
PPTX
Arrays in Java
PPT
Data Structures- Part5 recursion
PPT
Function overloading(c++)
PPTX
Queue - Data Structure - Notes
PPTX
linked list in data structure
PPTX
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
PPTX
Stacks IN DATA STRUCTURES
PPTX
Arrays in c
PPTX
Pointer in C++
Singly link list
Doubly Linked List
Linked list
Queue Implementation Using Array & Linked List
Presentation on Function in C Programming
single linked list
Circular link list.ppt
03 Linear Arrays Memory Representations .pdf
Linked List
Row major and column major in 2 d
Arrays in Java
Data Structures- Part5 recursion
Function overloading(c++)
Queue - Data Structure - Notes
linked list in data structure
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
Stacks IN DATA STRUCTURES
Arrays in c
Pointer in C++
Ad

Similar to Deletion from single way linked list and search (20)

PPTX
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
PPTX
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
PPTX
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
PPTX
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
PPTX
Linked Lists, Single Linked list and its operations
PPTX
Linked list (1).pptx
PPTX
UNIT -4 Singly Linked List-kiruthika.pptx
PDF
ds-lecture-4-171012041008 (1).pdf
PPTX
1.3 Linked List.pptx
PPTX
DSL Unit 4 (Linked list) (PPT)SE3rd sem sppu.pptx
PPTX
Linked List Representation of a Linked List.pptx
PPTX
csc211_lecture_21.pptx
DOCX
Linked list.docx
PPTX
Linked List in Data Structure
PPTX
Datastucture-Unit 4-Linked List Presentation.pptx
PPTX
linked list_MODULE 3.pptx ppt on the linked list
PPTX
Unit II Data Structure 2hr topic - List - Operations.pptx
PPT
Operations on linked list
PDF
Linked list (introduction) 1
PPT
ANOITO2341988888888888888888888885555.ppt
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
deletionfromsinglewaylinkedlistandsearch-180407173723.pptx
Linked Lists, Single Linked list and its operations
Linked list (1).pptx
UNIT -4 Singly Linked List-kiruthika.pptx
ds-lecture-4-171012041008 (1).pdf
1.3 Linked List.pptx
DSL Unit 4 (Linked list) (PPT)SE3rd sem sppu.pptx
Linked List Representation of a Linked List.pptx
csc211_lecture_21.pptx
Linked list.docx
Linked List in Data Structure
Datastucture-Unit 4-Linked List Presentation.pptx
linked list_MODULE 3.pptx ppt on the linked list
Unit II Data Structure 2hr topic - List - Operations.pptx
Operations on linked list
Linked list (introduction) 1
ANOITO2341988888888888888888888885555.ppt
Ad

More from Estiak Khan (20)

PPTX
Decision tree
PPTX
Steps in simulation study
PPTX
Smart bajarlist wireless
PPTX
Spiral model
PPTX
Scrum agile-process
PPTX
Waterfall model
PPTX
V model
PPTX
Use case-slide
PPTX
Graphical user-interface
PPTX
Graphical User Interface (GUI)
PPTX
Graphical user-interface (GUI)
PPTX
Future operating system
PPTX
Android operating system
PPTX
Cloud computing
PPTX
Disadvantages of cloud computing
PPTX
Determinants of supply
PPT
Law of supply
PPTX
Distributed systems-analysis-and-design
PPTX
wireless networking
PPTX
Online Banking System
Decision tree
Steps in simulation study
Smart bajarlist wireless
Spiral model
Scrum agile-process
Waterfall model
V model
Use case-slide
Graphical user-interface
Graphical User Interface (GUI)
Graphical user-interface (GUI)
Future operating system
Android operating system
Cloud computing
Disadvantages of cloud computing
Determinants of supply
Law of supply
Distributed systems-analysis-and-design
wireless networking
Online Banking System

Recently uploaded (20)

PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PDF
English Language Teaching from Post-.pdf
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Open folder Downloads.pdf yes yes ges yes
Open Quiz Monsoon Mind Game Prelims.pptx
English Language Teaching from Post-.pdf
UPPER GASTRO INTESTINAL DISORDER.docx
O5-L3 Freight Transport Ops (International) V1.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Open Quiz Monsoon Mind Game Final Set.pptx
Revamp in MTO Odoo 18 Inventory - Odoo Slides
102 student loan defaulters named and shamed – Is someone you know on the list?
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
O7-L3 Supply Chain Operations - ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

Deletion from single way linked list and search

  • 1. Deletion from single way linked list and search PRESENTED BY: M D I S L A M K H A N 171-15-9537 A B D U L L A H A L R E D WA N 171-15-9538 A S I Q U R R A H M A N A S I Q 171-15-9528 M O M I N U R I S L A M A S A D 163-15-8523
  • 2. Linked list linked list is a linear data structure. It contains nodes. Each node contains two parts, i.e. DATA part and LINK part.  The data contains elements , and  Link contains address of another node.
  • 3. WHAT ARE LINKED LISTS A linked list is a linear data structure. Nodes make up linked lists. Nodes are structures made up of data and a pointer to another node.  Usually the pointer is called next.
  • 4. TYPES OF LINKED LISTS 1. Single linked list. 2. Double linked list. 3. Circular linked list. 4. Circular double linked list.
  • 5. Singly Linked List  Each node has only one link part. Each link part contains the address of the next node in the list. Link part of the last node contains NULL value which signifies the end of the node.
  • 6. BASIC OPERATIONS ON A LIST  Creating a List  Inserting an element in a list  Deleting an element from a list  Searching a list  Reversing a list
  • 7. Deleting a Node in SLL Here also we have three cases:- Deleting the first node Deleting the last node Deleting the intermediate node
  • 8. DELETING THE FIRST NODE Here we apply 2 steps:-  Making the start pointer point towards the 2nd node. Deleting the first node using delete keyword.
  • 9. void delete_from_first() { struct node* temp=head; head=head->next/temp->next; free(temp); }
  • 10. Deleting the last node Here we apply 2 steps:-  Making the second last node’s next pointer point to NULL.  Deleting the last node via delete keyword.
  • 11. void delete_from_last() { struct node *temp=head, *temp2; while(temp->next) { temp2=temp; temp=temp->next; } temp2->next=NULL; free(temp); }
  • 12. Deleting a particular node Here we make the next pointer of the node previous to the node being deleted ,point to the successor node of the node to be deleted and then delete the node using. delete keyword.
  • 13. void delete_from_any_position(int pos) { int i ; struct node *temp=head, *temp2; for(i=2 ; i<pos ; i++) { temp=temp->next; } temp2=temp->next temp->next=temp2->next; free(temp2); }
  • 14. Searching a SLL  Searching involves finding the required element in the list.  We can use various techniques of searching like linear search or binary search where binary search is more efficient in case of Arrays.  But in case of linked list since random access is not available it would become complex to do binary search in it.  We can perform simple linear search traversal.
  • 15.  In linear search each node is traversed till the data in the node matches with the required value: void search (int x) { node*temp=start; while(temp!=NULL) { if(temp->data==x) { cout<<“FOUND ”<<temp->data; break; } temp=temp->next; }
  • 16. APPLICATIONS OF LINKED LIST A linked list is a very efficient data structure for sorted list that will go through many insertions and deletions. A linked list is a dynamic data structure in which the list can start with no nodes and then grow as new nodes are needed. A node can be easily deleted without moving other nodes, as would be the case with an array. For example, a linked list could be used to hold the records of students in a school. Each quarter or semester , new students enroll in the school and some students leave or graduate.
  • 17.  Advantages of using a Linked list: Save space (don’t have to worry about sparse polynomials) and easy to maintain.  Don’t need to allocate list size and can declare nodes (terms) only as needed. Operation related to data elements like insertions or deletion are more simplified  Disadvantages of using a Linked list :  Can’t go backwards through the list.  Can’t jump to the beginning of the list from the end.