typedef struct
{
datatype data[1024];
int top;
int pop;
}seqstack;
/**** 空栈 *****/
void SETNULL(seqstack *s)
{
s->top=-1;
s->pop=-1;
}
/**** 入栈 *****/
void PUSH(seqstack *s,datatype x,int nc_size)
{
if(s->top==nc_size-1)
{
s->pop++;
s->data[s->pop]=x;
}
else
{
s->top++;
s->data[s->top]=x;
}
}
/**** 栈空 *****/
int EMPTY(seqstack *s)
{
if(s->top>=0)return 0;
else return 1;
}
/**** 用于LRU入栈 *****/
void PUSH1(seqstack *s,datatype x,int nc_size){
// s->pop++;
while(s->poppop++;
if(s->data[s->pop]==x){
for(int i=s->pop;idata[i]=s->data[i+1];
}
}
}
s->data[s->top]=x;
}
/**** 判断 *****/
int FULL(seqstack *s,int nc_size)
{
if(s->top==nc_size-1)return 1;
else return 0;
}
/**** 压栈 *****/
void POP(seqstack *s,int nc_size)
{
if(EMPTY(s))
{}
else
{
for(int i=0;idata[i]=s->data[i+1];
s->top--;
}
}
void showzhan(seqstack *s,int nc_size){
for(int k=nc_size-1;k>=0;k--){
cout<<"栈队列----------------------[ "
1