SlideShare a Scribd company logo
Linked Lists CH Gowri Kumar [email_address]
struct node { int data; struct node* next; }; typedef struct node Node; typedef struct node* List; List  Initialize(); void InsertBegin(List l,int d); void InsertEnd(List l, int d); void Insert(List l, Node* pos,int d); Node* Find(List l,int d); void Delete(List l, int d);
Menu Initialize InsertBegin InsertEnd Insert Find Delete
Initialize
List  Initialize() { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); return temp; }
List  Initialize() { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); return temp; } main() { List head; head = Initialize(); } X head
InsertBegin
X head 1 10 8 4 6 3 2 5
X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1
X head 1 10 8 4 6 3 2 5 1
1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } X head 1
1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } X head 1
1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; } X head 1
X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1
X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1 10
X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; } 1 10
InsertEnd
X head 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; . . . . . . . . . . . . . . . .  } 10 1 tail
1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; . . . . . . . . . . . . . . . .  } X head 10 1 tail
1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; . . . . . . . . . . . . . . . .  } X head 10 1 tail
X head 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { . . . . . . . . . . . . . . . .  temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; tail->next = temp; } 10 1 8 tail
Insert
X head 1 10 8 4 6 3 2 5 void Insert(List head,Node* p,int d) { temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = p->next; p->next = temp; } 10 1 8
X head 1 10 8 4 6 3 2 5 void Insert(List head,Node* p,int d) { temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = p->next; p->next = temp; } 10 1 8 4
X head 1 10 8 4 6 3 2 5 8 10 1 4
Find
X head 1 10 8 4 6 3 2 5 8 void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; } 10 1 4
X head 1 10 8 4 6 3 2 5 8 void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; } 10 1 4 temp
Delete
X head 1 10 8 4 6 3 2 5 8 void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } } 10 4 1
X head 1 10 8 4 6 3 2 5 8 void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } } 10 4 1 temp del
X head 10 8 4 6 3 2 5 10 4 8
int main { List l; Node* temp; l = Initialize(); InsertBegin(l,1); InsertBegin(l,10); InsertEnd(l,8); temp = Find(l,8); Insert(l,temp,4); Delete(l,1); }
The End

More Related Content

What's hot (20)

PPT
Stack
srihariyenduri
 
PPTX
Stack and Queue
Apurbo Datta
 
PPTX
Tree in data structure
ghhgj jhgh
 
PDF
Digital electronics(EC8392) unit- 1-Sesha Vidhya S/ ASP/ECE/RMKCET
SeshaVidhyaS
 
PDF
Double ended queue
jyoti_lakhani
 
PPT
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
PPT
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
PPTX
Link list
Didar Rashad
 
PPT
Conversion of Infix To Postfix Expressions
Kulachi Hansraj Model School Ashok Vihar
 
PPTX
Insertion Sort
Brett Duncan
 
PPTX
Doubly & Circular Linked Lists
Afaq Mansoor Khan
 
PPTX
Queues
nidhisatija1
 
PDF
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
Balwant Gorad
 
PPTX
Rules of Karnaugh Map
Tanjarul Islam Mishu
 
PPT
Data Structures with C Linked List
Reazul Islam
 
PPTX
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
PPTX
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
PDF
8086 microprocessor lab manual
University of Technology - Iraq
 
PPTX
Stack using Linked List
Sayantan Sur
 
PPTX
Deletion from single way linked list and search
Estiak Khan
 
Stack and Queue
Apurbo Datta
 
Tree in data structure
ghhgj jhgh
 
Digital electronics(EC8392) unit- 1-Sesha Vidhya S/ ASP/ECE/RMKCET
SeshaVidhyaS
 
Double ended queue
jyoti_lakhani
 
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
Array Presentation (EngineerBaBu.com)
EngineerBabu
 
Link list
Didar Rashad
 
Conversion of Infix To Postfix Expressions
Kulachi Hansraj Model School Ashok Vihar
 
Insertion Sort
Brett Duncan
 
Doubly & Circular Linked Lists
Afaq Mansoor Khan
 
Queues
nidhisatija1
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
Balwant Gorad
 
Rules of Karnaugh Map
Tanjarul Islam Mishu
 
Data Structures with C Linked List
Reazul Islam
 
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
8086 microprocessor lab manual
University of Technology - Iraq
 
Stack using Linked List
Sayantan Sur
 
Deletion from single way linked list and search
Estiak Khan
 

Viewers also liked (20)

PPT
Linked lists
SARITHA REDDY
 
PPTX
Linked list
akshat360
 
PPT
linked list
Narendra Chauhan
 
PPT
Link List
umiekalsum
 
PPT
Linked list
Trupti Agrawal
 
PPS
Single linked list
jasbirsingh chauhan
 
PPTX
Linked List
Ashim Lamichhane
 
PPTX
Linked list
VONI
 
PPT
linked list (c#)
swajahatr
 
PPTX
Linked list
Dr. Shashank Shetty
 
PPTX
Array implementation and linked list as datat structure
Tushar Aneyrao
 
PDF
Data structures (introduction)
Arvind Devaraj
 
PPT
DATA STRUCTURES
bca2010
 
PPTX
Ppt of operations on one way link list
Sukhdeep Kaur
 
PPTX
3.linked list
Chandan Singh
 
PPTX
Python Spell Checker
Amr Alarabi
 
PPTX
Lecture 6: linked list
Vivek Bhargav
 
PPTX
Linked list
Lovelyn Rose
 
PPTX
Linked List data structure
Marcus Biel
 
PPTX
Linked Lists
Hafiz Umair
 
Linked lists
SARITHA REDDY
 
Linked list
akshat360
 
linked list
Narendra Chauhan
 
Link List
umiekalsum
 
Linked list
Trupti Agrawal
 
Single linked list
jasbirsingh chauhan
 
Linked List
Ashim Lamichhane
 
Linked list
VONI
 
linked list (c#)
swajahatr
 
Linked list
Dr. Shashank Shetty
 
Array implementation and linked list as datat structure
Tushar Aneyrao
 
Data structures (introduction)
Arvind Devaraj
 
DATA STRUCTURES
bca2010
 
Ppt of operations on one way link list
Sukhdeep Kaur
 
3.linked list
Chandan Singh
 
Python Spell Checker
Amr Alarabi
 
Lecture 6: linked list
Vivek Bhargav
 
Linked list
Lovelyn Rose
 
Linked List data structure
Marcus Biel
 
Linked Lists
Hafiz Umair
 
Ad

Similar to Linked lists (20)

PDF
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
FOREVERPRODUCTCHD
 
PPTX
DSA(1).pptx
DaniyalAli81
 
DOCX
Linked list imp of list
Elavarasi K
 
PDF
Lab-2.2 717822E504.pdf
21E135MAHIESHWARJ
 
DOCX
Lab Week 2 Game Programming.docx
teyaj1
 
DOCX
Linked lists
George Scott IV
 
PDF
#includeiostream struct node {    char value;    struct no.pdf
ankitmobileshop235
 
PDF
#includeiostream#includecstdio#includecstdlibusing names.pdf
KUNALHARCHANDANI1
 
PDF
137 Lab-2.2.pdf
21E135MAHIESHWARJ
 
DOCX
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
DIPESH30
 
DOCX
Bsf23006565 dsa 3rd assignment.docx............
XEON14
 
DOCX
DS Code (CWH).docx
KamalSaini561034
 
PDF
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
PDF
#include iostream #includestdlib.h using namespace std;str.pdf
lakshmijewellery
 
DOC
Ds 2 cycle
Chaitanya Kn
 
PPT
Doublylinklist
ritu1806
 
PDF
Please need help on following program using c++ language. Please inc.pdf
nitinarora01
 
PDF
Please finish the int LLInsert function.typedef struct STUDENT {.pdf
fortmdu
 
PDF
#includeiostream #includecstdio #includecstdlib using na.pdf
harihelectronicspune
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
FOREVERPRODUCTCHD
 
DSA(1).pptx
DaniyalAli81
 
Linked list imp of list
Elavarasi K
 
Lab-2.2 717822E504.pdf
21E135MAHIESHWARJ
 
Lab Week 2 Game Programming.docx
teyaj1
 
Linked lists
George Scott IV
 
#includeiostream struct node {    char value;    struct no.pdf
ankitmobileshop235
 
#includeiostream#includecstdio#includecstdlibusing names.pdf
KUNALHARCHANDANI1
 
137 Lab-2.2.pdf
21E135MAHIESHWARJ
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
DIPESH30
 
Bsf23006565 dsa 3rd assignment.docx............
XEON14
 
DS Code (CWH).docx
KamalSaini561034
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
#include iostream #includestdlib.h using namespace std;str.pdf
lakshmijewellery
 
Ds 2 cycle
Chaitanya Kn
 
Doublylinklist
ritu1806
 
Please need help on following program using c++ language. Please inc.pdf
nitinarora01
 
Please finish the int LLInsert function.typedef struct STUDENT {.pdf
fortmdu
 
#includeiostream #includecstdio #includecstdlib using na.pdf
harihelectronicspune
 
Ad

More from GowriKumar Chandramouli (9)

PPT
Telugu Alphabets
GowriKumar Chandramouli
 
PPT
Counting Bits
GowriKumar Chandramouli
 
PDF
Azim Premji on Changing World
GowriKumar Chandramouli
 
PPS
Who moved my cheese
GowriKumar Chandramouli
 
PPS
Parable Of a Pencil
GowriKumar Chandramouli
 
PPT
Binary Search Tree
GowriKumar Chandramouli
 
PPT
Insertion Sort
GowriKumar Chandramouli
 
PPT
Next higher number with same number of binary bits set
GowriKumar Chandramouli
 
Telugu Alphabets
GowriKumar Chandramouli
 
Azim Premji on Changing World
GowriKumar Chandramouli
 
Who moved my cheese
GowriKumar Chandramouli
 
Parable Of a Pencil
GowriKumar Chandramouli
 
Binary Search Tree
GowriKumar Chandramouli
 
Insertion Sort
GowriKumar Chandramouli
 
Next higher number with same number of binary bits set
GowriKumar Chandramouli
 

Recently uploaded (20)

PPTX
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
PPTX
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PDF
Vietnam Street Food & QSR Market 2025-1.pdf
ssuserec8cd0
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PPTX
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
AIMA UCSC-SV Leadership_in_the_AI_era 20250628 v16.pptx
home
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
epi editorial commitee meeting presentation
MIPLM
 
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Vietnam Street Food & QSR Market 2025-1.pdf
ssuserec8cd0
 
Introduction presentation of the patentbutler tool
MIPLM
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Introduction to Indian Writing in English
Trushali Dodiya
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
Controller Request and Response in Odoo18
Celine George
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 

Linked lists

  • 1. Linked Lists CH Gowri Kumar [email_address]
  • 2. struct node { int data; struct node* next; }; typedef struct node Node; typedef struct node* List; List Initialize(); void InsertBegin(List l,int d); void InsertEnd(List l, int d); void Insert(List l, Node* pos,int d); Node* Find(List l,int d); void Delete(List l, int d);
  • 3. Menu Initialize InsertBegin InsertEnd Insert Find Delete
  • 5. List Initialize() { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); return temp; }
  • 6. List Initialize() { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); return temp; } main() { List head; head = Initialize(); } X head
  • 8. X head 1 10 8 4 6 3 2 5
  • 9. X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; }
  • 10. X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1
  • 11. X head 1 10 8 4 6 3 2 5 1
  • 12. 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } X head 1
  • 13. 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } X head 1
  • 14. 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; } X head 1
  • 15. X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1
  • 16. X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = head->next; head->next = temp; } 1 10
  • 17. X head 1 10 8 4 6 3 2 5 void InsertBegin(List head,int d) { Node* temp; temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; head->next = temp; temp->next = head->next; } 1 10
  • 19. X head 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; . . . . . . . . . . . . . . . . } 10 1 tail
  • 20. 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; . . . . . . . . . . . . . . . . } X head 10 1 tail
  • 21. 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { Node *tail,*temp; tail = head; while(tail->next != NULL) tail = tail->next; . . . . . . . . . . . . . . . . } X head 10 1 tail
  • 22. X head 1 10 8 4 6 3 2 5 void InsertEnd(List head,int d) { . . . . . . . . . . . . . . . . temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; tail->next = temp; } 10 1 8 tail
  • 24. X head 1 10 8 4 6 3 2 5 void Insert(List head,Node* p,int d) { temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = p->next; p->next = temp; } 10 1 8
  • 25. X head 1 10 8 4 6 3 2 5 void Insert(List head,Node* p,int d) { temp = (Node*)calloc(1,sizeof(Node)); temp->data = d; temp->next = p->next; p->next = temp; } 10 1 8 4
  • 26. X head 1 10 8 4 6 3 2 5 8 10 1 4
  • 27. Find
  • 28. X head 1 10 8 4 6 3 2 5 8 void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; } 10 1 4
  • 29. X head 1 10 8 4 6 3 2 5 8 void Find(List l,Node* p,int d) { Node *temp; temp = l; while(temp->next != NULL) { if(temp->next->data == d) return temp; temp = temp->next; } return NULL; } 10 1 4 temp
  • 31. X head 1 10 8 4 6 3 2 5 8 void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } } 10 4 1
  • 32. X head 1 10 8 4 6 3 2 5 8 void Delete(List l,Node* p,int d) { Node *temp,*del; temp = Find(l,d); if(temp != NULL) { del = temp->next; temp->next = del->next; free(del); } } 10 4 1 temp del
  • 33. X head 10 8 4 6 3 2 5 10 4 8
  • 34. int main { List l; Node* temp; l = Initialize(); InsertBegin(l,1); InsertBegin(l,10); InsertEnd(l,8); temp = Find(l,8); Insert(l,temp,4); Delete(l,1); }