2

How and why non deterministic PDA is more powerful than deterministic PDA? Please explain.

Corion
  • 3,855
  • 1
  • 17
  • 27
Rajesh Sarkar
  • 51
  • 1
  • 6

1 Answers1

2

There are languages that nondeterministic PDAs can accept which cannot be accepted by deterministic PDAs. A simple example of such a language is the language of all (for simplicity, say even-length) palindromes (say, over the English alphabet). At each step, a deterministic PDA must decide whether to push the next symbol to the stack or to match the next symbol against the symbol on top of the stack. However, there is no way this can be done correctly since the DPDA has no way of knowing it's at the halfway point in the string. The nondeterministic PDA (NPDA) works by guessing at each step that it's half way through the input and proceeding on that basis. It will make lots of wrong guesses, but one of the guesses will be right, and if the string is a palindrome, the NPDA will accept the string on that branch. Since NPDAs accept a string if one of the paths accepts, this means NPDAs can correctly accept the language, but DPDAs can't.

Patrick87
  • 27,682
  • 3
  • 38
  • 73