Double linked list

0 views
911 views

Published on

DLL Practicals

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
0
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
92
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Double linked list

  1. 1. 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;
  2. 2. Double Linked Listvoid main(){ int ch; clrscr(); do { printf("n***MENU***"); printf("n1.Insertn2.Deleten3.Searchn4.Displayn5.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();}
  3. 3. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); 1 for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } New
  4. 4. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); 10 c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } New 10
  5. 5. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } New 10
  6. 6. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }start = NULL New 10
  7. 7. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }start = NULL New 10
  8. 8. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } c=0+1 New, 10 start
  9. 9. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("Data Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("n Invalid Position...n"); c++; } } c=0+1 New, 10 start
  10. 10. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); 2 for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 New
  11. 11. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); 20 c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 New 20
  12. 12. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 New 20
  13. 13. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 New 20 p
  14. 14. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 New 20 p
  15. 15. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }q = NULL start 10 New 20 p
  16. 16. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }q = NULL start 10 New 20 p
  17. 17. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }q = NULL start 10 New 20 p
  18. 18. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("Data Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } }q = NULL start 10 New 20 p
  19. 19. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); 2 for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 New 15
  20. 20. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); 15 c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 New 15
  21. 21. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 New 15
  22. 22. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 P New 15
  23. 23. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 P New 15
  24. 24. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 p q New 15
  25. 25. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 p q New 15
  26. 26. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 p q New 15
  27. 27. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 p q New 15
  28. 28. void insert() else{ { printf("nEnter the position where to insert..."); p=start; scanf("%d",&pos); for(i=1;i<pos-1;i++) New=(struct node *)malloc(sizeof(struct node)); p=p->next; New->prev=New->next=NULL; q = p->next; if(pos<=c+1) New->next=q; New->prev=p; { p->next=New; printf("nEnter the data to be inserted..."); q->prev=New; scanf("%d",&New->data); c++; if(pos==1) } { printf("nData Inserted Successfully ); New->next=start; } start->prev=New; else start=New; printf("nInvalid Position...n"); c++; } } start 10 20 p q New 15
  29. 29. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20
  30. 30. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); 15 r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20
  31. 31. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  32. 32. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  33. 33. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  34. 34. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  35. 35. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  36. 36. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p
  37. 37. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 p q
  38. 38. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 r p q
  39. 39. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 r p q
  40. 40. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 15 20 r p q
  41. 41. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20
  42. 42. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); 10 r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20
  43. 43. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20 p
  44. 44. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20 p
  45. 45. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20 p
  46. 46. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } start 10 20 p
  47. 47. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } 10 20 p start
  48. 48. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } 10 20 p start
  49. 49. void del() if(p->prev==NULL){ { if(start==NULL) start=start->next; { start->prev=NULL; printf("nList is Empty...n"); } return; else } { printf("nEnter the Data to be Deleted...n"); q = p->next; scanf("%d",&item); r = p->prev; p=start; r->next = q; while(p!=NULL&&p->data!=item) q->prev = r; p=p->next; } if(p==NULL) c--; { printf("%d is Deleted...n",p->data); printf("nData is not found...n"); free(p); return; } } 20 start
  50. 50. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20
  51. 51. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); 15 if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20
  52. 52. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  53. 53. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  54. 54. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  55. 55. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  56. 56. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  57. 57. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found...n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p
  58. 58. void search() while(p!=NULL){ { if(start==NULL) if(item==p->data) { { printf("nList is Empty...n"); printf("Data is Found.n"); return; break; } } printf("nEnter the Item to be p=p->next; Searched..."); } scanf("%d",&item); if(p==NULL) p=start; printf("nData is not Found...n"); } start 10 15 20 p

×