Upload
raviahuja11
View
577
Download
2
Tags:
Embed Size (px)
DESCRIPTION
DLL Practicals
Citation preview
Double Linked List#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<alloc.h>
struct node
{
int data;
struct node *prev,*next;
}*start=NULL,*p,*q, *r, *New;
int item, pos, c=0, i;
Double Linked Listvoid main()
{
int ch;
clrscr();
do
{
printf("\n***MENU***");
printf("\n1.Insert\n2.Delete\n3.Search\n4.Display\n5.Exit");
printf("\nPlease Enter the choice...");
scanf("%d",&ch); 1
switch(ch)
{
case 1:insert();break;
case 2:del();break;
case 3:search();break;
case 4:disp();break;
case 5:exit(0);
default:printf("\nInvalid Choice...\n");
}
}while(ch!=5);
getch();
}
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos); 1
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data); 10
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start = NULL
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start = NULL
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
c = 0 + 1
New,
start
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
c = 0 + 1
New,
start
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("Data Inserted Successfully );
}
else
printf("\n Invalid Position...\n");
}
\ 10 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos); 2
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data); 20
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
q = NULL
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
q = NULL
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
q = NULL
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 \ 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
q = NULL
start New
p
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("Data Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos); 2
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data); 15
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
P
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
P
New
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
pNew
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
q
\ 10 20 \
\ 15 \
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
pNew
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
q
\ 10 20 \
\ 15
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
pNew
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
q
\ 10 20 \
15
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
pNew
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
q
\ 10 20 \
15
void insert()
{
printf("\nEnter the position where to insert...");
scanf("%d",&pos);
New=(struct node *)malloc(sizeof(struct node));
New->prev=New->next=NULL;
if(pos<=c+1)
{
printf("\nEnter the data to be inserted...");
scanf("%d",&New->data);
if(pos==1)
{
New->next=start;
start->prev=New;
start=New;
c++;
}
start
pNew
else
{
p=start;
for(i=1;i<pos-1;i++)
p=p->next;
q = p->next;
New->next=q; New->prev=p;
p->next=New;
q->prev=New;
c++;
}
printf("\nData Inserted Successfully );
}
else
printf("\nInvalid Position...\n");
}
q
\ 10 20 \
15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item); 15
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
q
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
r p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
q
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
r p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
q
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
r p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
q
\ 10 20 \ 15
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item); 10
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
p
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
p start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
p start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 10 \ 20 \
void del()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Data to be Deleted...\n");
scanf("%d",&item);
p=start;
while(p!=NULL&&p->data!=item)
p=p->next;
if(p==NULL)
{
printf("\nData is not found...\n");
return;
}
start
if(p->prev==NULL)
{
start=start->next;
start->prev=NULL;
}
else
{
q = p->next;
r = p->prev;
r->next = q;
q->prev = r;
}
c--;
printf("%d is Deleted...\n",p->data);
free(p);
}
\ 20 \
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item); 15
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
p
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
p
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
p
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
p
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
p
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found...\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
p
\ 10 20 \ 15
void search()
{
if(start==NULL)
{
printf("\nList is Empty...\n");
return;
}
printf("\nEnter the Item to be Searched...");
scanf("%d",&item);
p=start;
start
while(p!=NULL)
{
if(item==p->data)
{
printf("Data is Found.\n");
break;
}
p=p->next;
}
if(p==NULL)
printf("\nData is not Found...\n");
}
p
\ 10 20 \ 15