SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
#include <stdio.h>
#include <stdlib.h>
typedef struct list{
int v;
struct list * n;
}h;
h*cr()
{
return (h*)malloc(sizeof(h));
}
void insert(h*t,int data){
while(t->n!=NULL)
{
t=t->n;
}
t->n=cr();
t->n->v=data;
t->n->n=NULL;
}
void dis(h*t)
{
while(t->n!=NULL)
{
printf("%d -> ",t->n->v);
t=t->n;
}
printf("NULL");
}
int search(h*t,int data)
{
int i=0;
while(t->n!=NULL)
{
i++;
if(data==t->n->v)
{
printf("nvalue found.Location= %dn",i);
return i;
}
t=t->n;
}
}
void inaf(h*t, int search, int data)
{
while(t->n != NULL)
{
if(t->n->v == search)
{
h *store = t->n->n;
t->n->n = cr();
t->n->n->v = data;
t->n->n->n = store;
}
t=t->n;
}
}
int del(h *t, int data)
{
while(t->n != NULL)
{
if(t->n->v == data)
{
t->n = t->n->n;
return 0;
}
t = t->n;
}
}
void countNode(h *t)
{
int count = 0;
while(t->n != NULL)
{
count++;
t = t->n ;
}
printf("nTotal %d nodes found.n", count);
}
int main()
{
h*f=cr();
f->n=NULL;
insert(f, 5);
insert(f, 9);
insert(f, 11);
insert(f, 9);
dis (f);c
countNode(f );
search(f, 9);
inaf (f, 11, 44);
del (f, 9);
dis(f);
}

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
 
Linear search
Linear searchLinear search
Linear search
 
One dimensional operation of Array in C- language
One dimensional operation of Array in C- language One dimensional operation of Array in C- language
One dimensional operation of Array in C- language
 
Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3
 
week-5x
week-5xweek-5x
week-5x
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
 
Session06 functions
Session06 functionsSession06 functions
Session06 functions
 
Grestest2
Grestest2Grestest2
Grestest2
 
week-21x
week-21xweek-21x
week-21x
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Computer programing w
Computer programing wComputer programing w
Computer programing w
 
Thesis PPT
Thesis PPTThesis PPT
Thesis PPT
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
 
A Shiny Example-- R
A Shiny Example-- RA Shiny Example-- R
A Shiny Example-- R
 
contoh Program queue
contoh Program queuecontoh Program queue
contoh Program queue
 
week-20x
week-20xweek-20x
week-20x
 
Vcs29
Vcs29Vcs29
Vcs29
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
 
Bcsl 033 data and file structures lab s4-2
Bcsl 033 data and file structures lab s4-2Bcsl 033 data and file structures lab s4-2
Bcsl 033 data and file structures lab s4-2
 

Andere mochten auch

Andere mochten auch (13)

Digital marketing and Social Media Marketing
Digital marketing and Social Media Marketing Digital marketing and Social Media Marketing
Digital marketing and Social Media Marketing
 
Link list
Link listLink list
Link list
 
W3C-LBDW BOT-HVAC
W3C-LBDW BOT-HVACW3C-LBDW BOT-HVAC
W3C-LBDW BOT-HVAC
 
Linked List data structure
Linked List data structureLinked List data structure
Linked List data structure
 
Linked list
Linked listLinked list
Linked list
 
Data Structure (Dynamic Array and Linked List)
Data Structure (Dynamic Array and Linked List)Data Structure (Dynamic Array and Linked List)
Data Structure (Dynamic Array and Linked List)
 
Teaching Linked Data to Librarians: A Discussion of Pedagogical Methods
Teaching Linked Data to Librarians: A Discussion of Pedagogical MethodsTeaching Linked Data to Librarians: A Discussion of Pedagogical Methods
Teaching Linked Data to Librarians: A Discussion of Pedagogical Methods
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
 
linked list
linked list linked list
linked list
 
6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil
 
Como exportar contactos de Linkedin a Excel
Como exportar contactos de Linkedin a ExcelComo exportar contactos de Linkedin a Excel
Como exportar contactos de Linkedin a Excel
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Ähnlich wie Linked list searching deleting inserting

Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
apexelectronices01
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
Sorting programs
Sorting programsSorting programs
Sorting programs
Varun Garg
 
#include ctype.h #include stdio.h #include string.hstati.pdf
#include ctype.h #include stdio.h #include string.hstati.pdf#include ctype.h #include stdio.h #include string.hstati.pdf
#include ctype.h #include stdio.h #include string.hstati.pdf
apleather
 
C basics
C basicsC basics
C basics
MSc CST
 
My C proggram is having trouble in the switch in main. Also the a co.pdf
My C proggram is having trouble in the switch in main. Also the a co.pdfMy C proggram is having trouble in the switch in main. Also the a co.pdf
My C proggram is having trouble in the switch in main. Also the a co.pdf
meerobertsonheyde608
 

Ähnlich wie Linked list searching deleting inserting (20)

Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
Programs
ProgramsPrograms
Programs
 
Sorting programs
Sorting programsSorting programs
Sorting programs
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
i nsert+in+ link list
i nsert+in+ link listi nsert+in+ link list
i nsert+in+ link list
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
#include ctype.h #include stdio.h #include string.hstati.pdf
#include ctype.h #include stdio.h #include string.hstati.pdf#include ctype.h #include stdio.h #include string.hstati.pdf
#include ctype.h #include stdio.h #include string.hstati.pdf
 
C basics
C basicsC basics
C basics
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
My C proggram is having trouble in the switch in main. Also the a co.pdf
My C proggram is having trouble in the switch in main. Also the a co.pdfMy C proggram is having trouble in the switch in main. Also the a co.pdf
My C proggram is having trouble in the switch in main. Also the a co.pdf
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Statistics.cpp
Statistics.cppStatistics.cpp
Statistics.cpp
 
Pnno
PnnoPnno
Pnno
 

Mehr von Samsil Arefin

Mehr von Samsil Arefin (20)

Transmission Control Protocol and User Datagram protocol
Transmission Control Protocol and User Datagram protocolTransmission Control Protocol and User Datagram protocol
Transmission Control Protocol and User Datagram protocol
 
Evolution Phylogenetic
Evolution PhylogeneticEvolution Phylogenetic
Evolution Phylogenetic
 
Evolution Phylogenetic
Evolution PhylogeneticEvolution Phylogenetic
Evolution Phylogenetic
 
Ego net facebook data analysis
Ego net facebook data analysisEgo net facebook data analysis
Ego net facebook data analysis
 
Augmented Reality (AR)
Augmented Reality (AR)Augmented Reality (AR)
Augmented Reality (AR)
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
 
Strings in programming tutorial.
Strings  in programming tutorial.Strings  in programming tutorial.
Strings in programming tutorial.
 
Number theory
Number theoryNumber theory
Number theory
 
Linked list int_data_fdata
Linked list int_data_fdataLinked list int_data_fdata
Linked list int_data_fdata
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracing
 
Stack
StackStack
Stack
 
Sorting
SortingSorting
Sorting
 
Fundamentals of-electric-circuit
Fundamentals of-electric-circuitFundamentals of-electric-circuit
Fundamentals of-electric-circuit
 
Cyber security
Cyber securityCyber security
Cyber security
 
C programming
C programmingC programming
C programming
 
Data structure lecture 1
Data structure   lecture 1Data structure   lecture 1
Data structure lecture 1
 
Structure and union
Structure and unionStructure and union
Structure and union
 
Structure in programming in c or c++ or c# or java
Structure in programming  in c or c++ or c# or javaStructure in programming  in c or c++ or c# or java
Structure in programming in c or c++ or c# or java
 
String
StringString
String
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Linked list searching deleting inserting

  • 1. #include <stdio.h> #include <stdlib.h> typedef struct list{ int v; struct list * n; }h; h*cr() { return (h*)malloc(sizeof(h)); } void insert(h*t,int data){ while(t->n!=NULL) { t=t->n; } t->n=cr(); t->n->v=data; t->n->n=NULL; } void dis(h*t) { while(t->n!=NULL)
  • 2. { printf("%d -> ",t->n->v); t=t->n; } printf("NULL"); } int search(h*t,int data) { int i=0; while(t->n!=NULL) { i++; if(data==t->n->v) { printf("nvalue found.Location= %dn",i); return i; } t=t->n; } } void inaf(h*t, int search, int data) { while(t->n != NULL) {
  • 3. if(t->n->v == search) { h *store = t->n->n; t->n->n = cr(); t->n->n->v = data; t->n->n->n = store; } t=t->n; } } int del(h *t, int data) { while(t->n != NULL) { if(t->n->v == data) { t->n = t->n->n; return 0; } t = t->n; } }
  • 4. void countNode(h *t) { int count = 0; while(t->n != NULL) { count++; t = t->n ; } printf("nTotal %d nodes found.n", count); } int main() { h*f=cr(); f->n=NULL; insert(f, 5); insert(f, 9); insert(f, 11); insert(f, 9); dis (f);c countNode(f );
  • 5. search(f, 9); inaf (f, 11, 44); del (f, 9); dis(f); }