SlideShare a Scribd company logo
Singly linked list
program in data
structure PPT
#include<stdio.h>
#include<conio.h>
struct node
{
int info;
node *next;
};
node *head,*tail;
void beg()
{
node *p=new node();
printf("n enter the number");
scanf("n%d",&p->info);
if(head==NULL)
{
p->next=NULL;
head=p;
tail=p;
}
else
{
p->next=head;
head=p;
}
}
void end()
{
node *p=new node();
printf("n enter the number");
scanf("n%d",&p->info);
if(head==NULL)
{
p->next=NULL;
head=p;
tail=p;
}
else
{
tail->next=p;
tail=p;
p->next=NULL;
}
}
void after()
{
int n;
printf("n enter the number you want to search");
scanf("n%d",&n);
node *max;
max=head;
while(max!=NULL)
{
if(max->info==n)
{
break;
}
max=max->next;
}
if(max==NULL)
{
printf("n number is not found");
}
else
{
node *p=new node();
printf("nentere the number");
scanf("%d",&p->info);
if(max==tail)
{
p->next=NULL;
tail->next=p;
tail=p;
}
else
{
p->next=max->next;
max->next=p;
}
}
}
void before()
{
int n;
printf("n enter the number you want to search");
scanf("n%d",&n);
node *max,*max1;
max=head;
max1=head;
while(max!=NULL)
{
if(max->info==n)
{
break;
}
max1=max;
max=max->next;
}
if(max==NULL)
{
printf("n number not found");
}
else
{
node *p=new node();
printf("n enter the number");
scanf("n%d",&p->info);
if(max==head)
{
p->next=head;
head=p;
}
else
{
p->next=max;
max1->next=p;
}
}
}
void dbeg()
{
if(head==NULL)
{
printf("n deletd number=%d",head->info);
}
else
{
printf("n deleted number is=>%d",head->info);
head=head->next;
}
}
void dend()
{
if(head==NULL)
{
printf("n underflow error");
}
else
{
node *max;
max=head;
while(max->next->next!=NULL)
{
max=max->next;
}
printf("n delete number %5d",tail->info);
max->next=NULL;
tail=max;
}
}
void dafter()
{
int n;
printf("n enter the number");
scanf("n%d",&n);
node *max;
max=head;
while(max!=NULL)
{
if(max->info==n)
{
break;
} max=max->next;
}
if(max==NULL)
{
printf("n number not found");
}
else
{
if(max->next->next==NULL)
{
printf("n deleted number%d",max->next-
>info);
max->next=NULL;
tail=max;
}
else
{
printf("n deleted number %d",max->next-
>info);
max->next=max->next->next;
}
}
void dbefore()
{
int n;
printf("n enter the number");
scanf("n%d",&n);
node *max,*max1,*max2;
max=head;
while(max!=NULL)
{
if(max->info==n)
{
break;
}
max2=max1;
max1=max;
max=max->next;
}
if(max==NULL)
{
printf("n number is not found");
}
else
{
if(max==head)
{
printf("n deleted number is %d",max->info);
max=max->next;
head=max;
}
else
{
printf("n deleted number %d",max1->info);
max2->next=max;
}
}
}
void display()
{
if(head==NULL)
{
printf("n underflow error");
}
else
{
node *max;
max=head;
while(max!=NULL)
{
printf("%5d",max->info);
max=max->next;
}
}
}
void main()
{
clrscr();
int ch;
head=NULL;
tail=NULL;
do
{
printf("n ....main menu.....");
printf("n 1.insert at the begginning");
printf("n 2.insert at the ending");
printf("n 3.insert at the position after");
printf("n 4.insert at the position before");
printf("n 5.delete at the beg");
printf("n 6.delete at the end");
printf("n 7,deleted at the position after");
printf("n 8.deleted at the position before");
printf("n 9.display");
printf("n 10.exit");
printf("n enter your choice");
scanf("n%d",&ch);
switch(ch)
{
case 1:beg();
break;
case 2:end();
break;
case 3:after();
break;
case 4:before();
break;
case 5:dbeg();
break;
case 6:dend();
break;
case 7:dafter();
break;
case 8:dbefore();
break;
case 9:display();
break;
default:printf("n you enter wrong
choice!!!!!!!!!");
break;
}
}while(ch!=NULL);
getch();
}
This program solved by Piyush Sharma (Presented by Jitendra Kumar JAVA Trainer at Vtech
Academy of Computers)- C | C++ | DS | JAVA | Android | Python & Oracle Expert

More Related Content

PPT
Doublylinklist
PPTX
LINKED LISTS
PPT
Linked list
PPT
Linked list
PPTX
Lecture 6: linked list
PDF
Data Structures Practical File
PDF
linked list
PPTX
Linked list
Doublylinklist
LINKED LISTS
Linked list
Linked list
Lecture 6: linked list
Data Structures Practical File
linked list
Linked list

What's hot (20)

PPTX
Linear data structure concepts
PPS
Single linked list
PDF
VTU Data Structures Lab Manual
PPT
PDF
Data structures lab manual
PPT
DOC
Ds lab manual by s.k.rath
DOCX
Ahad Butt
PPTX
Single linked list
PPTX
Circular linked list
PDF
PDF
C lab excellent
PPTX
Linked list
DOCX
Data Structures Using C Practical File
PDF
Most Important C language program
DOCX
Data structure new lab manual
PDF
Data structure lab manual
DOCX
Data Structure Project File
PPTX
Linked List - Insertion & Deletion
DOCX
2 a networkflow
Linear data structure concepts
Single linked list
VTU Data Structures Lab Manual
Data structures lab manual
Ds lab manual by s.k.rath
Ahad Butt
Single linked list
Circular linked list
C lab excellent
Linked list
Data Structures Using C Practical File
Most Important C language program
Data structure new lab manual
Data structure lab manual
Data Structure Project File
Linked List - Insertion & Deletion
2 a networkflow
Ad

Similar to Singly linked list program in data structure - Vtech (20)

PPTX
Singly linked list.pptx
DOCX
double link list in data structure
PDF
#includeiostream struct node {    char value;    struct no.pdf
DOCX
Solutionsfor co2 C Programs for data structures
PDF
TutorialII_Updated____niceupdateprogram.pdf
DOCX
C++ adt c++ implementations
DOCX
Write a program that calculate the no of prime no,even and odd no.
PDF
The Program to find out the middle of a given linked listclass Lin.pdf
PPTX
C Assignment Help
DOCX
Write code in C++ Write a program to perform a topological sort on a g.docx
PDF
Program of sorting using shell sort #include stdio.h #de.pdf
DOCX
Bubble in link list
DOCX
DS Code (CWH).docx
DOC
C basics
DOCX
Implement of c &amp; its coding programming by sarmad baloch
PDF
program on string in java Lab file 2 (3-year)
PDF
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
PDF
Rewrite this code so it can use a generic type instead of integers. .pdf
PDF
C code on linked list #include stdio.h #include stdlib.h.pdf
Singly linked list.pptx
double link list in data structure
#includeiostream struct node {    char value;    struct no.pdf
Solutionsfor co2 C Programs for data structures
TutorialII_Updated____niceupdateprogram.pdf
C++ adt c++ implementations
Write a program that calculate the no of prime no,even and odd no.
The Program to find out the middle of a given linked listclass Lin.pdf
C Assignment Help
Write code in C++ Write a program to perform a topological sort on a g.docx
Program of sorting using shell sort #include stdio.h #de.pdf
Bubble in link list
DS Code (CWH).docx
C basics
Implement of c &amp; its coding programming by sarmad baloch
program on string in java Lab file 2 (3-year)
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
Rewrite this code so it can use a generic type instead of integers. .pdf
C code on linked list #include stdio.h #include stdlib.h.pdf
Ad

More from Vtech Academy of Computers (6)

PPTX
Pfames Technical Workshop
PPTX
Bank management system project in c++ with graphics
PPTX
Republic Day - vtechedu.in
PPTX
Republic Day - www.vtechedu.in
PDF
C program to print alphabets from a to z
PPTX
Ms Word Shortcut Keys - Vtech Academy
Pfames Technical Workshop
Bank management system project in c++ with graphics
Republic Day - vtechedu.in
Republic Day - www.vtechedu.in
C program to print alphabets from a to z
Ms Word Shortcut Keys - Vtech Academy

Recently uploaded (20)

PPTX
Cell Types and Its function , kingdom of life
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Basic Mud Logging Guide for educational purpose
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Pre independence Education in Inndia.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Cell Types and Its function , kingdom of life
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Sports Quiz easy sports quiz sports quiz
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
01-Introduction-to-Information-Management.pdf
PPH.pptx obstetrics and gynecology in nursing
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
VCE English Exam - Section C Student Revision Booklet
Microbial disease of the cardiovascular and lymphatic systems
Renaissance Architecture: A Journey from Faith to Humanism
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Basic Mud Logging Guide for educational purpose
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study
GDM (1) (1).pptx small presentation for students
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
human mycosis Human fungal infections are called human mycosis..pptx
Pre independence Education in Inndia.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

Singly linked list program in data structure - Vtech