Enque and Deque

This commit is contained in:
Anup Kumar Panwar 2016-08-09 16:40:41 +05:30
parent 045eb06531
commit dd750e621b
3 changed files with 18 additions and 18 deletions

View File

@ -6,7 +6,7 @@ int front=0;
int rear=0;
int count=0;
void push(int x)
void Enque(int x)
{
if(count==10)
{
@ -20,7 +20,7 @@ void push(int x)
}
}
void pop()
void Deque()
{
if (front==rear)
{
@ -50,8 +50,8 @@ int main()
int ch, x;
do
{
cout<<"\n1. Push";
cout<<"\n2. Pop";
cout<<"\n1. Enque";
cout<<"\n2. Deque";
cout<<"\n3. Print";
cout<<"\nEnter Your Choice : ";
cin>>ch;
@ -59,11 +59,11 @@ int main()
{
cout<<"\nInsert : ";
cin>>x;
push(x);
Enque(x);
}
else if (ch==2)
{
pop();
Deque();
}
else if (ch==3)
{

View File

@ -5,7 +5,7 @@ int queue[10];
int front=0;
int rear=0;
void push(int x)
void Enque(int x)
{
if(rear==10)
{
@ -17,7 +17,7 @@ void push(int x)
}
}
void pop()
void Deque()
{
if (front==rear)
{
@ -51,8 +51,8 @@ int main()
int ch, x;
do
{
cout<<"\n1. Push";
cout<<"\n2. Pop";
cout<<"\n1. Enque";
cout<<"\n2. Deque";
cout<<"\n3. Print";
cout<<"\nEnter Your Choice : ";
cin>>ch;
@ -60,11 +60,11 @@ int main()
{
cout<<"\nInsert : ";
cin>>x;
push(x);
Enque(x);
}
else if (ch==2)
{
pop();
Deque();
}
else if (ch==3)
{

View File

@ -11,7 +11,7 @@ struct node
node *front, *rear;
void push(int x)
void Enque(int x)
{
if (rear==NULL)
{
@ -33,7 +33,7 @@ void push(int x)
}
}
void pop()
void Deque()
{
if (rear==front)
{
@ -63,8 +63,8 @@ int main()
int ch, x;
do
{
cout<<"\n1. Push";
cout<<"\n2. Pop";
cout<<"\n1. Enque";
cout<<"\n2. Deque";
cout<<"\n3. Print";
cout<<"\nEnter Your Choice : ";
cin>>ch;
@ -72,11 +72,11 @@ int main()
{
cout<<"\nInsert : ";
cin>>x;
push(x);
Enque(x);
}
else if (ch==2)
{
pop();
Deque();
}
else if (ch==3)
{