πŸŽ“ Computer Science & Engineering Portal

Master Engineering Disciplines with Structured Notes

Comprehensive academic lecture notes, exam-oriented unit summaries, laboratory manuals, and previous year question papers designed strictly for university students.

πŸ“‘

University Syllabi

AKTU & AICTE aligned semester guidelines.

πŸ“

Exam Question Papers

Previous 5 years solved university papers.

πŸ’‘

Lab Manuals & Viva

Practical codes with outputs & interview Qs.

Core Subjects & Units Hub

Click on any specific unit to immediately view its lecture notes below

Viewing All Lectures

Non-deterministic Pushdown Automata

Non-deterministic Pushdown Automata

The CFG which accepts deterministic PDA accepts non-deterministic PDAs as well. Similarly, there are some CFGs which can be accepted only by NPDA and not by DPDA. Thus NPDA is more powerful than DPDA.

The Non-deterministic Push down Automata (NPDAs) are like finite automata (FA), except they also have a stack memory where they can store an arbitrary amount of information.

Read/write stack memory works as LIFO: Last In, First Out

What can we do with a stack?

The pop operation reads the top symbol and removes it from the stack, the push operation writes a designated symbol onto the top of the stack, e.g. push(X) means put X on top of the stack, the nop operation does nothing to the stack.

The stack symbols are different from the β€œlanguage” alphabet used on the input tape.

We start with the following βˆ’

  • With only the initial stack symbol on the stack, (nothing else on the stack!) in the start state of the control automaton.

  • At each step, the state, input element and top symbol in the stack determine the next step (transition).

One transition step includes the following βˆ’

  • Change the state, (as FA).

  • Reading of a symbol from the input tape and moving to the next right symbol,(as FA).

  • Change the stack (pushing a symbol onto the stack/popping a symbol of the stack/no changes to the stack).

Transition steps are formally defined by transition functions (often in the form of the transition instructions).

NPDA can be described as the following βˆ’

  • A finite set Q of states (& the start state & the set of accepting/final states).

  • A finite set βˆ‘ which is called the input alphabet.

  • A finite set Ξ“ which is called the stack alphabet (& the initial stack symbol $).

  • A finite set of transition instructions (or a transition function T).

T : Q Γ— βˆ‘ βˆͺ {∧} Γ— Ξ“ β†’ Ξ“* Γ— Q

Or it is represented by β€˜transition’ diagram as given below βˆ’

Example:

Design PDA for Palindrome strips.

Solution: Suppose the language consists of string L = {aba, aa, bb, bab, bbabb, aabaa, ......]. The string can be odd palindrome or even palindrome. The logic for constructing PDA is that we will push a symbol onto the stack till half of the string then we will read each symbol and then perform the pop operation. We will compare to see whether the symbol which is popped is similar to the symbol which is read. Whether we reach to end of the input, we expect the stack to be empty.

This PDA is a non-deterministic PDA because finding the mid for the given string and reading the string from left and matching it with from right (reverse) direction leads to non-deterministic moves. Here is the ID.

Non-deterministic Pushdown Automata

Simulation of abaaba

Ξ΄(q1, abaaba, Z)            Apply rule 1  
⊒ Ξ΄(q1, baaba, aZ)          Apply rule 5  
⊒ Ξ΄(q1, aaba, baZ)          Apply rule 4  
⊒ Ξ΄(q1, aba, abaZ)          Apply rule 7  
⊒ Ξ΄(q2, ba, baZ)            Apply rule 8  
⊒ Ξ΄(q2, a, aZ)              Apply rule 7  
⊒ Ξ΄(q2, Ξ΅, Z)               Apply rule 11  
⊒ Ξ΄(q2, Ξ΅)                  Accept

Labels: ,

Discussion & Queries (<$I18NNumComments$>):

<$CommentPager$>
<$I18NAtCommentTimeWithPermalink$>, <$I18NCommentAuthorSaid$>

<$BlogCommentBody$>

<$BlogCommentDeleteIcon$>
<$CommentPager$>