第4章 栈与队列-----栈
Posted 影_魔
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第4章 栈与队列-----栈相关的知识,希望对你有一定的参考价值。
栈 (stack)是限定仅在表尾进行插入和删除操作的线性表。
允许插入和删除的一端称为栈顶(top),另一端为栈底(bottom),不含任何数据元素的栈称为空栈。栈又称为后进先出(Last In First Out)的线性表,简称LIFO结构。

栈的抽象数据类型


实例:StaticSize是5,则栈普通情况、空栈和栈满的情况示意图如图4-4-2所示

栈的顺序存储结构----进栈操作

栈的顺序存储结构---出栈操作


栈的链式存储结构---进栈操作


栈的链式存储结构-----出栈操作

如果栈的使用过程中元素变化不可预料,有时很小,有时非常大,那么最好是用链栈,反而,如果它的变化在可控范围内,建议使用顺序栈会更好一些。
以上是关于第4章 栈与队列-----栈的主要内容,如果未能解决你的问题,请参考以下文章