SlideShare a Scribd company logo
1 of 6
Presented by: MANSOOR IQBAL Roll No. 36 Semester: 5th
Email: mansooriqbal2244@gmail.com Phone #: +923209114016
 Linked-list is a linear data structure, in which one has a data part and the
other is link part or you can say pointer. The combination of data part and
pointer part is called a node.
Node = Data part + pointer part(link part)
 Linked-list is a collection of nodes. The pointer variable is used to store the address of
next node.
 The last node pointer part must be NULL (φ). (see next page).
Data part pointer part
12 100
head
node1 node2 node3
100 200 300
 The link part contains the address of next node.
 The head is also a pointer variable which is store the address of the
first node. Every linked-list must be one head pointer.
 The addresses of node1, node2 and node3 is 100, 200 and 300
respectively.
100
2 200 4 300 4 φ
This algorithm is used to traverse (access) each node of the Linked-list.
Step # 1: [ Declaration ]
integer type count  0
structure pointer variable temp type node
Step # 2: [ Assign head address to temp pointer variable]
temp  head
Step # 3: [ Starting Loop]
repeat step 4 and step 5 until temp≠ NULL
Step # 4: [ Assigning next node address]
temp  temp  next
Step # 5: [ Counting nodes]
count  count +1
Step # 6: [ Finish]
Exit
void Traversal ( )
{
int count= 0;
struct node *temp;
temp= head;
while ( temp!= NULL )
{
temp= temp  next;
count++;
}
}
Linked list
Head
100 200 300
100
2 200 4 300 4 φ
Linked list traversal

More Related Content

Similar to Linked list traversal

MULTIPLICATION OF 2 POLYNOMIALS.pptx
MULTIPLICATION OF 2 POLYNOMIALS.pptxMULTIPLICATION OF 2 POLYNOMIALS.pptx
MULTIPLICATION OF 2 POLYNOMIALS.pptx
AarulMishra
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
arjunstores123
 
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docxSIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
edgar6wallace88877
 

Similar to Linked list traversal (20)

Unit II Data Structure 2hr topic - List - Operations.pptx
Unit II  Data Structure 2hr topic - List - Operations.pptxUnit II  Data Structure 2hr topic - List - Operations.pptx
Unit II Data Structure 2hr topic - List - Operations.pptx
 
csc211_lecture_21.pptx
csc211_lecture_21.pptxcsc211_lecture_21.pptx
csc211_lecture_21.pptx
 
02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo
 
Data structure
Data structureData structure
Data structure
 
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
Linked ListLinked List
Linked List
 
Linked list
Linked listLinked list
Linked list
 
C++ Sorting The parameter to the following two recursive routines is.pdf
C++ Sorting The parameter to the following two recursive routines is.pdfC++ Sorting The parameter to the following two recursive routines is.pdf
C++ Sorting The parameter to the following two recursive routines is.pdf
 
3.ppt
3.ppt3.ppt
3.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Data Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptxData Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptx
 
MULTIPLICATION OF 2 POLYNOMIALS.pptx
MULTIPLICATION OF 2 POLYNOMIALS.pptxMULTIPLICATION OF 2 POLYNOMIALS.pptx
MULTIPLICATION OF 2 POLYNOMIALS.pptx
 
Module 3 Dara structure notes
Module 3 Dara structure notesModule 3 Dara structure notes
Module 3 Dara structure notes
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptx
 
In the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdfIn the class we extensively discussed a node class called IntNode in.pdf
In the class we extensively discussed a node class called IntNode in.pdf
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
 
data structures lists operation of lists
data structures lists operation of listsdata structures lists operation of lists
data structures lists operation of lists
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Linked List
Linked ListLinked List
Linked List
 
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docxSIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
SIT221 Data Structures and Algorithms     Trimester 2, 2019 .docx
 

Recently uploaded

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Recently uploaded (20)

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

Linked list traversal

  • 1. Presented by: MANSOOR IQBAL Roll No. 36 Semester: 5th Email: mansooriqbal2244@gmail.com Phone #: +923209114016
  • 2.  Linked-list is a linear data structure, in which one has a data part and the other is link part or you can say pointer. The combination of data part and pointer part is called a node. Node = Data part + pointer part(link part)  Linked-list is a collection of nodes. The pointer variable is used to store the address of next node.  The last node pointer part must be NULL (φ). (see next page). Data part pointer part 12 100
  • 3. head node1 node2 node3 100 200 300  The link part contains the address of next node.  The head is also a pointer variable which is store the address of the first node. Every linked-list must be one head pointer.  The addresses of node1, node2 and node3 is 100, 200 and 300 respectively. 100 2 200 4 300 4 φ
  • 4. This algorithm is used to traverse (access) each node of the Linked-list. Step # 1: [ Declaration ] integer type count  0 structure pointer variable temp type node Step # 2: [ Assign head address to temp pointer variable] temp  head Step # 3: [ Starting Loop] repeat step 4 and step 5 until temp≠ NULL Step # 4: [ Assigning next node address] temp  temp  next Step # 5: [ Counting nodes] count  count +1 Step # 6: [ Finish] Exit
  • 5. void Traversal ( ) { int count= 0; struct node *temp; temp= head; while ( temp!= NULL ) { temp= temp  next; count++; } } Linked list Head 100 200 300 100 2 200 4 300 4 φ

Editor's Notes

  1. Name: MANSOOR IQBAL Roll No. 36 Subject: BSCS Semester: 5h
  2. Name: MANSOOR IQBAL Roll No. 36 Subject: BSCS Semester: 5h
  3. Name: MANSOOR IQBAL Roll No. 36 Subject: BSCS Semester: 5h
  4. Name: MANSOOR IQBAL Roll No. 36 Subject: BSCS Semester: 5h