[prev] 82 [next]

Example: A Stack as an Abstract Data Object (ADO)

Stack, aka pushdown stack or LIFO data structure (last in, first out)

Assume (for the time being) a stack of char values

Operations:

  • create empty stack
  • insert (push) an item onto stack
  • remove (pop) most recently pushed item
  • check whether stack is empty
Applications:
  • undo sequence in a text editor
  • bracket matching algorithm