Implementation of Queue using Stacks
Algorithm for insertion queue using stacks
Algorithm fnQInsertion_using_stack(arrSTACK1[], Data)
{
if(top1==MAXSIZE-1)
Queue is full;
else
fnPush(arrSTACK1[], Data);
} // End of Algorithm
Algorithm for deletion queue using stacks
Algorithm fnQDelete_using_stack(arrSTACK1[], arrSTACK2[])
{
if(top1==-1)
Queue is empty;
else
{
while(top1!=-1)
fnPush(arrSTACK2[], fnPop(arrSTACK2[]));
Data=fnPop(arrSTACk2[]);
while(top21=-1)
fnPush(arrSTACK1[], fnPop(arrSTACK2[]));
return Data;
}
} // End of Algorithm