SlideShare a Scribd company logo
1 of 20
 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.
Arrays Vs Linked Lists
Arrays Linked list
Fixed size: Resizing is expensive Dynamic size
Insertions and Deletions are inefficient:
Elements are usually shifted
Insertions and Deletions are efficient: No
shifting
Random access i.e., efficient indexing No random access
 Not suitable for operations requiring
accessing elements by index such as sorting
No memory waste if the array is full or almost
full; otherwise may result in much memory
waste.
Since memory is allocated dynamically(acc. to
our need) there is no waste of memory.
Sequential access is faster [Reason: Elements in
contiguous memory locations]
Sequential access is slow [Reason: Elements not
in contiguous memory locations]
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
Schematic representation
 Here is a singly-linked list (SLL):
a b c d
myList
• Each node contains a value(data) and a
pointer to the next node in the list
• myList is the header pointer which points
at the first node in the list
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
Inserting the node in a SLL
There are 3 cases here:-
Insertion at the beginning
Insertion at the end
Insertion after a particular node
Insertion at the beginning
There are two steps to be followed:-
a) Make the next pointer of the node point towards the first node of the
list
b) Make the start pointer point towards this new node
 If the list is empty simply make the start pointer point towards the new
node;
Inserting at the end
Here we simply need to make the next pointer
of the last node point to the new node
Inserting after an element
Here we again need to do 2 steps :-
 Make the next pointer of the node to be
inserted point to the next node of the node
after which you want to insert the node
 Make the next pointer of the node after which
the node is to be inserted, point to the node to
be inserted
Inserting after an element at end
algorithm :-
 STEP-1: new=getnode
 STEP-2: temp=first
 STEP-3: while(temp->next)!=NULL
 STEP-4: temp=temp->next
 STEP-5: end while
 STEP-6: temp->next=new
 STEP-7: temp=new
 STEP-8: stop
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
threetwoone
start
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
node3node2node1
start
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
node1 node2 node3
To be deleted
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
Reversing a linked list
• We can reverse a linked list by reversing the
direction of the links between 2 nodes
 We make use of 3 structure pointers say p,q,r
 At any instant q will point to the node next to p and r will point to the
node next to q
NULLHead P q r
NULL
• For next iteration p=q and q=r
• At the end we will change head to the last node
p q

More Related Content

What's hot

What's hot (19)

Linked list
Linked listLinked list
Linked list
 
Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]
 
Singly linked list
Singly linked listSingly linked list
Singly linked list
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Linked list
Linked listLinked list
Linked list
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
linked list
linked list linked list
linked list
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Data Structure (Double Linked List)
Data Structure (Double Linked List)Data Structure (Double Linked List)
Data Structure (Double Linked List)
 
linked list
linked listlinked list
linked list
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
Linked lists 1
Linked lists 1Linked lists 1
Linked lists 1
 
Deletion from single way linked list and search
Deletion from single way linked list and searchDeletion from single way linked list and search
Deletion from single way linked list and search
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Sorting & Linked Lists
Sorting & Linked ListsSorting & Linked Lists
Sorting & Linked Lists
 
Singly link list
Singly link listSingly link list
Singly link list
 
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
 

Viewers also liked

Viewers also liked (17)

Data structures, bcs 3 c- linked list
Data structures, bcs 3 c- linked listData structures, bcs 3 c- linked list
Data structures, bcs 3 c- linked list
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Caja entradas y salidas
Caja entradas y salidasCaja entradas y salidas
Caja entradas y salidas
 
презентация группы "Сказка"
презентация группы "Сказка"презентация группы "Сказка"
презентация группы "Сказка"
 
Uso Seguro de la Red
Uso Seguro de la RedUso Seguro de la Red
Uso Seguro de la Red
 
21 Trends For Nurse Practitioners In 2016
21 Trends For Nurse Practitioners In 201621 Trends For Nurse Practitioners In 2016
21 Trends For Nurse Practitioners In 2016
 
презентация 8гр "Дружная семейка"
презентация 8гр "Дружная семейка"презентация 8гр "Дружная семейка"
презентация 8гр "Дружная семейка"
 
группа 10 почемучки
группа 10 почемучкигруппа 10 почемучки
группа 10 почемучки
 
цветик семицветик
цветик семицветикцветик семицветик
цветик семицветик
 
цветик семицветик
цветик семицветикцветик семицветик
цветик семицветик
 
New Rules Strategies 2015
New Rules Strategies 2015New Rules Strategies 2015
New Rules Strategies 2015
 
SocialMedia_Vogts
SocialMedia_VogtsSocialMedia_Vogts
SocialMedia_Vogts
 
группа 10 почемучки
группа 10 почемучкигруппа 10 почемучки
группа 10 почемучки
 
External Resume 16Jan2016
External Resume 16Jan2016External Resume 16Jan2016
External Resume 16Jan2016
 
Trabajo sobre internet
Trabajo sobre internetTrabajo sobre internet
Trabajo sobre internet
 
группа 10 почемучки
группа 10 почемучкигруппа 10 почемучки
группа 10 почемучки
 
группа пчёлка 7гр
группа пчёлка 7гргруппа пчёлка 7гр
группа пчёлка 7гр
 

Similar to linked list using c

data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Linked List in Data Structure
Linked List in Data StructureLinked List in Data Structure
Linked List in Data StructureMeghaj Mallick
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptxssuserd2f031
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked listsAbdullah Al-hazmy
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm KristinaBorooah
 
LinkedList Presentation.pptx
LinkedList Presentation.pptxLinkedList Presentation.pptx
LinkedList Presentation.pptxwahid431192
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdfSonaPathak5
 
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
 

Similar to linked list using c (20)

data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Linked List in Data Structure
Linked List in Data StructureLinked List in Data Structure
Linked List in Data Structure
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
Linked list
Linked listLinked list
Linked list
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
LinkedList Presentation.pptx
LinkedList Presentation.pptxLinkedList Presentation.pptx
LinkedList Presentation.pptx
 
linked list
linked list linked list
linked list
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdf
 
Linked Lists.pdf
Linked Lists.pdfLinked Lists.pdf
Linked Lists.pdf
 
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
 
Linear data structure concepts
Linear data structure conceptsLinear data structure concepts
Linear data structure concepts
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 

Recently uploaded

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
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
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
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 

Recently uploaded (20)

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
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
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
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
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
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 

linked list using c

  • 1.  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.
  • 2. Arrays Vs Linked Lists Arrays Linked list Fixed size: Resizing is expensive Dynamic size Insertions and Deletions are inefficient: Elements are usually shifted Insertions and Deletions are efficient: No shifting Random access i.e., efficient indexing No random access  Not suitable for operations requiring accessing elements by index such as sorting No memory waste if the array is full or almost full; otherwise may result in much memory waste. Since memory is allocated dynamically(acc. to our need) there is no waste of memory. Sequential access is faster [Reason: Elements in contiguous memory locations] Sequential access is slow [Reason: Elements not in contiguous memory locations]
  • 3. 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
  • 4. Schematic representation  Here is a singly-linked list (SLL): a b c d myList • Each node contains a value(data) and a pointer to the next node in the list • myList is the header pointer which points at the first node in the list
  • 5. 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
  • 6. Inserting the node in a SLL There are 3 cases here:- Insertion at the beginning Insertion at the end Insertion after a particular node
  • 7. Insertion at the beginning There are two steps to be followed:- a) Make the next pointer of the node point towards the first node of the list b) Make the start pointer point towards this new node  If the list is empty simply make the start pointer point towards the new node;
  • 8.
  • 9.
  • 10. Inserting at the end Here we simply need to make the next pointer of the last node point to the new node
  • 11. Inserting after an element Here we again need to do 2 steps :-  Make the next pointer of the node to be inserted point to the next node of the node after which you want to insert the node  Make the next pointer of the node after which the node is to be inserted, point to the node to be inserted
  • 12. Inserting after an element at end algorithm :-  STEP-1: new=getnode  STEP-2: temp=first  STEP-3: while(temp->next)!=NULL  STEP-4: temp=temp->next  STEP-5: end while  STEP-6: temp->next=new  STEP-7: temp=new  STEP-8: stop
  • 13.
  • 14. Deleting a node in SLL Here also we have three cases:-  Deleting the first node  Deleting the last node  Deleting the intermediate node
  • 15. 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 threetwoone start
  • 16. 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 node3node2node1 start
  • 17. 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 node1 node2 node3 To be deleted
  • 18. 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
  • 19. Reversing a linked list • We can reverse a linked list by reversing the direction of the links between 2 nodes
  • 20.  We make use of 3 structure pointers say p,q,r  At any instant q will point to the node next to p and r will point to the node next to q NULLHead P q r NULL • For next iteration p=q and q=r • At the end we will change head to the last node p q