Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
0Activity
×
0 of .
Results for:
No results containing your search query
P. 1
Lab File Programs[11]

Lab File Programs[11]

Ratings: (0)|Views: 94|Likes:
Published by Sumeet Bachchas
LINKED LINK IMPLEMENTATION OF QUEUE
LINKED LINK IMPLEMENTATION OF QUEUE

More info:

Categories:Types, School Work
Published by: Sumeet Bachchas on Feb 09, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, DOC, TXT or read online from Scribd
See More
See less

02/09/2011

pdf

text

original

 
Data Structure Lab (ECS-352)
PROGRAM 10
OBJECTIVE
:-
Write a program
 
to linked list implementation of Queue.# include<stdio.h># include<malloc.h>#include<conio.h>struct node{ int info;struct node *link;}*front=NULL,*rear=NULL;void insert(){struct node *tmp;int added_item;tmp = (struct node *)malloc(sizeof(struct node));printf("Input the element for adding in queue : ");scanf("%d",&added_item);tmp->info = added_item;tmp->link=NULL;if(front==NULL)front=tmp;elserear->link=tmp;rear=tmp;}void del(){struct node *tmp;if(front == NULL)printf("Queue Underflow\n");else{tmp=front;printf("Deleted element is %d\n",tmp->info);front=front->link;free(tmp);}}
SUMEET BACHCHAS (0909113117) B-Tech III Sem (IT) J.S.S.A.T.E,Noida
 
Data Structure Lab (ECS-352)
void display(){struct node *ptr;ptr = front;if(front == NULL)printf("Queue is empty\n");else{printf("Queue elements :\n");while(ptr != NULL){ printf("\t%d ",ptr->info);ptr = ptr->link;}}}void main(){int ch;do{ printf("\n1.Insert\n2.Delete\n3.Display\n4.Quit ");scanf("%d", &ch);switch(ch){case 1:insert();break;case 2:del();break;case 3:display();break;case 4:break;default :printf("Wrong choice\n");}}while(ch!=4);}
Output:
1.insert2.delete
SUMEET BACHCHAS (0909113117) B-Tech III Sem (IT) J.S.S.A.T.E,Noida

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->