automatapushdown-automaton

Find the center letter in 2 pdf (2 stack) in automata


Draw a 2PDA that accepts MIDDLE A of all words that have A as the middle letter.

Also, Explain the Logic of it.


Solution

  • It is a hard question for the beginners But you can solve it by using little bit concentration. It is simple...

    1. Read the first letter from and discard it and if the stack has only one letter then check it must be a other move forward.
    2. The read all the string and put it in the 1-stack.
    3. Pop the letter from the 1-stack and discard it.
    4. The pop all the letters and push all the letters it in the 2-stack.
    5. The repeat the step 2 with the 2-stack.

    If you pop a letter from a stack and it isaand both stacks are empty then the string is accepted.

    It is a solution of the above question, Sorry for writing.

    Happy Coding.