栈及其应用讲稿.pptVIP

  • 2
  • 0
  • 约4.07千字
  • 约 21页
  • 2020-03-22 发布于湖南
  • 举报
栈及其应用 栈 外特性:后进先出(LIFO) 交卷子 KTV的“点歌单” 作用:保护现场 逻辑结构:只在一端操作的线性表 数组实现: 元素 stack : array[1..maxn] of integer 栈顶指针 top 栈的存储表示 顺序栈的数据结构表示 const maxsize=栈的大小; type sqstktp=record elem: array[1..stack_size] of elemtp; top:0..maxsize; end 链栈 lnkstack=^node node =record elem:elemtp; top:lnkstack; end; 栈的基本操作 func push(var s:sqstktp; x:elemtp):boolean; begin if top=stack_size then return(false); {栈满} else begin s.top:=s.top+1; s.elem[s.top]:=x; return(t

文档评论(0)

1亿VIP精品文档

相关文档