
栈和栈的应用
聆听心碎的声音
我很懒,但是我又不肯认输!
展开
-
括号配对
描述 现在,有一行括号序列,请你检查这行括号是否配对。 输入第一行输入一个数N(0 输出每组输入数据的输出占一行,如果该字符串中所含的括号是配对的,则输出Yes,如果不配对则输出No 样例输入 3 [(]) (]) ([[]()]) 样例输出 No No Yes #include const int N = 10005; int sta[原创 2015-08-05 15:50:25 · 320 阅读 · 0 评论 -
多栈共享
#include #define M 100 typedef struct { int ste[M]; int top[2]; }node; void initlist(node *s) { s->top[0]=-1; s->top[1]=M; } void push(node *s) { int i,x=-1; while(x!=0) { printf("请输入原创 2015-11-07 20:22:43 · 486 阅读 · 0 评论 -
链栈 多链栈
#include #include #define M 10 typedef struct node { int date; struct node *next; }node; void put(node *top[M]) { int x=-1,i; node *temp; while(x!=0) { printf("请输入压栈的值和被压入元素的栈i:\n原创 2015-11-07 20:24:21 · 555 阅读 · 0 评论