0

I'm trying to use a finite state machine diagram to represent the Stack abstract data type, and I'm struggling to find a way to represent an unbounded alphabet. A stack can have an infinite number elements, but I can't draw infinite states in my diagram.

The solution I'm leaning toward is to use recursion, but I can't find any examples of expressing recursion in a finite state machine diagram. Is there a standard way to draw a recursion? Or is there another solution to my infinity problem?

Michael Hoffmann
  • 2,411
  • 2
  • 24
  • 42
  • Like you said, a stack is not a finite state machine, so why are you doing this exercise in the first place? There is a finite state machine called a "Push-down automaton" which utilizes a stack to store some of its state in addition to the machine's states. Is that what you're asking about? – Welbog Feb 13 '17 at 16:23
  • I was doing this for a school assignment, and a finite state machine is definitely what I was looking for. I'm confused too. – Michael Hoffmann Feb 13 '17 at 19:06

1 Answers1

0

The machine model that corresponds to a stack is the push-down automaton. This model is known to be more powerful than finite state machines. Thus it is impossible to represent a stack with the latter. There is no solution to your problem.

You do not have an unbounded alphabet, though. Only the number of symbols on the stack is unbounded.

Peter Leupold
  • 1,162
  • 1
  • 9
  • 16