#include "sqstack.h"
Status InitStack(Stack &S)
{
SElemType *data=new SElemType;
S.top=-1;
return true;
}
Status DestroyStack(Stack &S)
{
delete S.data;
return true;
}
Status StackEmpty(Stack &S)
{
if(S.top==-1)
return true;
else
return false;
}
Status Push(Stack &S,SElemType &e)
{
if(S.top==MaxSize-1)
return false;
S.top++;
S.data[S.top]=e;
return true;
}
Status Pop(Stack &S,SElemType &e)
{
if(S.top==-1)
return false;
e=S.data[S.top];
S.top--;
return true;
}
数据结构
最新推荐文章于 2024-08-10 23:17:45 发布