- 6
- 0
- 约2.4千字
- 约 13页
- 2017-08-15 发布于江苏
- 举报
* * 预备知识 链式存储结构: 栈空:S为空指针; 栈满:动态分配,除非溢出。 ∧ data next S a1 an-1 an 第6次课 栈的应用 一、实验目的: 理解栈是操作受限(插入push,删除pop)的线性表,受限的是插入删除的位置。 在链式存储结构下实现:StackEmpty,Push,Pop, 几个基本操作。 通过调用基本操作实现括号匹配算法。 引例 括号匹配的检验 表达式中有三种括号:“(”和“)”,“[”和“]”,“{”和“}”, 编写判别给定表达式中所含括号是否正确配对出现的算法 #includestdio.h #includestdlib.h #define True 1 #define False 0 #define OK 1 #define ERROR 0 typedef int status; typedef char ElemType; typedef struct SNode{ ElemType data; struct SNode *next; }SNode, *LinkStack; status InitStack(LinkStack S); int StackEmpty(LinkStack S); status Push(LinkStack S, ElemType e); status Pop(LinkStac
原创力文档

文档评论(0)