1.实现双头栈。
- 算法分析:
第一步:初始化,分配MAXSIZE=100给m,同时栈顶,栈底和栈数组也赋初值;
第二步: 栈空条件,0栈和1栈都空;
第三步:栈满条件,top[0]+top[1]==MAXSIZE;
第四步:进栈push,0栈和1栈的进栈;
第五步:出栈,0栈和1栈的出栈。
代码:
#include "stdio.h"
#define MAXSIZE 10
#define ERROR 0
#define OK 1
typedef int status;
typedef int elemtype;
typedef struct {