SlideShare a Scribd company logo
1 of 5
Download to read offline
#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);
}

More Related Content

What's hot (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
 

Viewers also liked

Digital marketing and Social Media Marketing
Digital marketing and Social Media Marketing Digital marketing and Social Media Marketing
Digital marketing and Social Media Marketing Karunakar K
 
Linked List data structure
Linked List data structureLinked List data structure
Linked List data structureMarcus Biel
 
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)Adam Mukharil Bachtiar
 
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 MethodsAllison Jai O'Dell
 
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 Patilwidespreadpromotion
 
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 Excelwebsa100
 

Viewers also liked (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
 

Similar to Linked list searching deleting inserting

Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File Rahul Chugh
 
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)Ankit Gupta
 
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.pdfapexelectronices01
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Er Ritu Aggarwal
 
Sorting programs
Sorting programsSorting programs
Sorting programsVarun Garg
 
i nsert+in+ link list
i nsert+in+ link listi nsert+in+ link list
i nsert+in+ link listEAJAJAhamed
 
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 structuresLakshmi Sarvani Videla
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming LanguageArkadeep Dey
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shortingargusacademy
 
#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.pdfapleather
 
C basics
C basicsC basics
C basicsMSc 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.pdfmeerobertsonheyde608
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C ProgramsKandarp Tiwari
 

Similar to 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
 

More from Samsil Arefin

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 protocolSamsil Arefin
 
Evolution Phylogenetic
Evolution PhylogeneticEvolution Phylogenetic
Evolution PhylogeneticSamsil Arefin
 
Evolution Phylogenetic
Evolution PhylogeneticEvolution Phylogenetic
Evolution PhylogeneticSamsil Arefin
 
Ego net facebook data analysis
Ego net facebook data analysisEgo net facebook data analysis
Ego net facebook data analysisSamsil Arefin
 
Augmented Reality (AR)
Augmented Reality (AR)Augmented Reality (AR)
Augmented Reality (AR)Samsil Arefin
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat applicationSamsil Arefin
 
Strings in programming tutorial.
Strings  in programming tutorial.Strings  in programming tutorial.
Strings in programming tutorial.Samsil Arefin
 
Linked list int_data_fdata
Linked list int_data_fdataLinked list int_data_fdata
Linked list int_data_fdataSamsil Arefin
 
Linked list Output tracing
Linked list Output tracingLinked list Output tracing
Linked list Output tracingSamsil Arefin
 
Fundamentals of-electric-circuit
Fundamentals of-electric-circuitFundamentals of-electric-circuit
Fundamentals of-electric-circuitSamsil Arefin
 
Data structure lecture 1
Data structure   lecture 1Data structure   lecture 1
Data structure lecture 1Samsil Arefin
 
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 javaSamsil Arefin
 
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++ Samsil Arefin
 

More from 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++
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.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); }