(1)void algo3(Queue &Q){
Stack S; int d;
InitStack(S);
while(!QueueEmpty(Q)){
DeQueue(Q,d);
Push(S,d);
}
while(!StackEmpty(S)){
Pop(S,d);
EnQueue(Q,d);
}
}
(2) void Demo1( Stack *S, int m)
{ Stack T; int i;
InitStack (T);
while (! StackEmpty(S))
if(( i=Pop(S)) !=m) Push( T,i);
while (! StackEmpty(T))
{
i=Pop(T); Push(S,i);
}
}
谢谢 啦 详细一点点 最好了
一只甜甜圈