- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Design NPDA for accepting the language L = {am b(2m) | m>=1}
Basically a push down automata (PDA) is as follows −
“Finite state machine+ a stack”
PDA has three components, which are as follows −
- An Input tape.
- A control unit.
- A Stack with infinite size.
A PDA can be formally described as seven tuples
(Q, Σ,S, δ,q0,I,F)
Where,
- Q is finite number of states
- Σ is input alphabet
- S is stack symbol
- Δ is the transition function: QX(Σ∪{e})XSXQ
- q0 is the initial state (q0 belongs to Q)
- I is the initial state top symbol
- F is a set of accepting states (F belongs to Q)
Problem
Construct a non-deterministic PDA (NPDA) for accepting the language
L = {a^m b^{2m} | m>=1}.
Solution
The strings which are generated by this language are −
L = {abb, aabbbb, aaabbbbbb, aaaabbbbbbbb, ......}
The language counts the number of a’s followed by a double number of b’s.
Explanation
Step 1 − Maintain the order of a’s and b’s.
Step 2 − Construct a stack along with the state diagram.
Step 3 − The count of a’s and b’s is maintained by the stack.
Step 4 − The number of b’s is exactly double of the number of a’s.
Step 5 − We will take 2 stack alphabets:
r = { a, z }
Where,
- r = Set of all the stack alphabet
- z = Start symbol
Construction of PDA for the given problem
The PDA is as follows −
Transition functions
The transition functions for the PDA are as follows −
Design a NPDA, when ‘a’ comes before b then push it in stack and if again ‘a’ comes again push it. Also, when ‘b’ comes then pop one ‘a’ from the stack.
But we do this popping operation for alternate positions of b’s, (for two b’s we pop one ‘a’ and for four b’s we pop two ‘a’).
Finally, at the end if the stack becomes empty then we can say that the string is accepted by the PDA.
- Related Articles
- For some integer $m$, every even integer is of the form,b>(A) $m$(B) $m + 1$(C) $2m$(D) $2m +1$
- Design a DFA accepting a language L having number of zeros in multiples of 3
- Construct a PDA for language L = {0n 1m2m3n | n>=1, m>=1}
- Construct PDA for accepting L = {anb(2n) | n>=1} U {anbn | n>=1}
- Design DFA for language over {0,1} accepting strings with odd number of 1’s and even number of 0’s
- Construct a ∈-NFA for the language L = (a* + b*)
- If \( a=x^{m+n} y^{l}, b=x^{n+l} y^{m} \) and \( c=x^{l+m} y^{n} \), prove that \( a^{m-n} b^{n-1} c^{l-m}=1 . \)
- Generate a Context-free grammar for the language L = {anbm| m≠n}?
- Construct PDA for L = {0n1m2(n+m) | m,n >=1}
- Construct a Turing Machine for language L = {0n1n2n | n≥1}
- Design a push down automaton for L = {wwR | w ∈ {a, b}+}?
- Construct a Turing Machine for language L = {wwr | w ∈ {0, 1}}
- Factorise : (lm + l) + m + 1
- Find the numerical value of \( P: Q \) where \( \mathrm{P}=\left(\frac{x^{m}}{x^{n}}\right)^{m+n-l} \times\left(\frac{x^{n}}{x^{l}}\right)^{n+l-m} \times\left(\frac{x^{l}}{x^{m}}\right)^{l+m-n} \) and\( \mathrm{Q}=\left(x^{1 /(a-b)}\right)^{1 /(a-c)} \times\left(x^{1 /(b-c)}\right)^{1 /(b-a)} \times\left(x^{1 /(c-a)}\right)^{1 /(c-b)} \)where \( a, b, c \) being all different.A. \( 1: 2 \)B. \( 2: 1 \)C. \( 1: 1 \)D. None of these
- Construct ∈-NFA of Regular Language L = 0(0+1)*1
