Professional Documents
Culture Documents
Aditya Shitole Dsu Project
Aditya Shitole Dsu Project
Aditya Shitole Dsu Project
IMPLEMENTATION OF QUEUE
#Course outcomes:-
1) Perform basic operations on array
2) Apply different searching and sorting techniques
3) Implement basic operations on queue using array representation.
# Proposed Methodology:-
The topic of the microproject is implementation of queue using linked list. For
this project we first learned about queue and linked list through are regular
lectures. Queue is a container of data items that are inserted and removed
according to the last-in-first-out(LIFO) principle. A Queue has a restriction that
insertion and deletion of element can only be done from only one end of queue
and we can call that position as top & a linked list is data structure consisiting of
collection of nodes in a sequence which is divided in two parts one the data and
second the address of the second node. After learning about these in detailed
through our daily lectures and practicals we formed a group of four members and
divided the work equally. The project was completed with the help of the teacher
some reference books and internet.
# Action Plan:-
Sr. Planned Name of
finished responsible
No. Details of Activity Planned team
date
start date members
Resources Required:
Sr.No. Name Of Specificatios Quantity Remarks
resources/material
1 Hardware: Computer Computer (i3-i5 01
System preferable) RAM
minimum 2GB and
onwards
2 Operating System Windows 7 or later 01
version/LINUX
versio 5.0 or Later
version
3 Software Turbo c/c++ version 01
3.0 or later version
clrscr();
printf("\nCircular
Queue
operations\n");
printf("1.Insert\n2
.Delete\n3.Displa
y\n4.Exit\n");
while(1)
{
printf("Enter your
choice:");
scanf("%d",&ch);
switch(ch)
{
case 1: insert();
break;
case 2: delet();
break;
case 3:display();
break;
case 4:exit();
default:printf("Inv
alid option\n");
}
}
}
void insert()
{
int x;
if((front==0&&rea
r==max-
1)||(front>0&&re
ar==front-1))
printf("Queue is
overflow\n");
else
{
printf("Enter
element to be
insert:");
scanf("%d",&x);
if(rear==max-
1&&front>0)
{
rear=0;
q[rear]=x;
}
else
{
if((front==0&&rea
r==-
1)||(rear!=front-
1))
q[++rear]=x;
}
}
}
void delet()
{
int a;
if((front==0)&&(re
ar==-1))
{
printf("Queue is
underflow\n");
getch();
exit();
}
if(front==rear)
{
a=q[front];
rear=-1;
front=0;
}
else
if(front==max-1)
{
a=q[front];
front=0;
} else
a=q[front++];
printf("Deleted
element
is:%d\n",a);
}
void display()
{
int i,j;
if(front==0&&rear
==-1)
{
printf("Queue is
underflow\n");
getch();
exit();
}
if(front>rear)
{
for(i=0;i<=rear;i++
)
{
printf("\t%d",q[i])
;
{
for(j=front;j<=max
-1;j++)
printf("\t%d",q[j])
;
printf("\nrear is
at %d\n",q[rear]);
printf("\nfront is
at
%d\n",q[front]);
}
}
}
else
{
for(i=front;i<=rear
i++)
{
printf("\t%d",q[i])
; }
printf("\nrear is at
%d\n",q[rear]);
printf("\nfront is
at
%d\n",q[front]);
}
printf("\n");
getch();
}