| | | | | |

Derivable Behaviors (Theorems)

  • If (n = S.size()) is followed by k push operations then n + k = S.size()
  • If (n = S.size()) is followed by k pop operations then n - k = S.size()

  •   in particular, k <= n
  • The last element of S pushed onto S is the top of S
  • S.pop() removes the last element of S pushed onto S
  • Any two stacks of type T are isomorphic

| | Top of Page | 5. Abstract Data Types: Stacks and Queues - 4 of 22