Found 349 Articles for Data Structure Algorithms

Construct DPDA for a(n+m)bmcn n,m≥1 in TOC

Bhanu Priya
Updated on 15-Jun-2021 15:00:03

672 Views

A push down automata (PDA) can be formally described as seven tuples(Q, Σ, S, δ, q0, I, F)Where, Q is finite number of statesΣ is input alphabetS is stack symbolΔ is the transition function: QX(Σ∪{e})XSXQq0 is the initial state (q0 belongs to Q)I is the initial state top symbolF is a set of accepting statesProblemConstruct PDA for a(n+m)bmcn n, m≥1.SolutionSo, the strings which are generated by the given language are −L={aabc, aaaabccc, aaaaabbccc, ….}That is to add the number of b's and c's, and that will equal the number of a's.For every b's and c's we will pop a's from ... Read More

How to use Turing machines to recognize languages in TOC?

Bhanu Priya
Updated on 16-Jun-2021 12:12:55

787 Views

A Turing machine (TM) can be formally described as seven tuples −(Q, X, ∑, δ, q0, B, F)Where, Q is a finite set of states.X is the tape alphabet.∑ is the input alphabet.δ is a transition function: 𝛿:QxX->QxXx{left shift, right shift}.q0 is the initial state.B is the blank symbol.F is the final state.A Turing machine T recognises a string x (over ∑) if and only when T starts in the initial position and x is written on the tape, T halts in a final state.T is said to recognize a language A, if x is recognised by T and if ... Read More

Explain the basic properties of the Turing machine?

Bhanu Priya
Updated on 15-Jun-2021 14:22:10

2K+ Views

Turing machines are more powerful than both finite automata (FA) and pushdown automata (PDA). They are as powerful as any computer we have ever built.The main improvements from PDAs in Turing machine are explained below −Infinite “all” accessible memory (in the form of a tape) – option to read and write to it.A read/write head can move to the left and to the right on the input tape (or don’t change a position).The TM works on an infinite tape divided into cells (infinite in both directions), each of which contains either a symbol from an alphabet or the blank symbol. ... Read More

Distinguish between DPDAs and NPDAs in TOC?

Bhanu Priya
Updated on 15-Jun-2021 14:18:46

5K+ Views

Similar to the finite automata (FA), push-down automata (PDA) can be either deterministic or non-deterministic.A deterministic push down automata (DPDA) never has a choice of the next step −It has the possible output for every combination of state, input character and stack character, as compared to the deterministic finite automata (DFA).We need to be careful about every combination of state and stack character. Only one of the transactions is allowed either for the empty symbol ∧ or for an input symbol. Or there can be no transaction at all.ExampleA non-deterministic push-down automaton (NPDA) can contain the following instructions, but a ... Read More

Design a push down automaton for L = {wwR | w ∈ {a, b}+}?

Bhanu Priya
Updated on 15-Jun-2021 13:40:41

5K+ Views

A pushdown automaton is used to implement a context-free grammar in the same way that we use a technique to design DFA for a regular grammar. A DFA work on a finite amount of information, where as a PDA works on an infinite amount of information.Generally, a pushdown automaton is −"Finite state machine" + "a stack"A pushdown automaton consist of three components −an input tape, a control unit, anda stack with infinite size.Now consider a problem that how to design push down automata for a given language −ProblemDesign a push down automaton which recognizes even length palindromes for L = ... Read More

What happens when a String is accepted or rejected by NPDA?

Bhanu Priya
Updated on 15-Jun-2021 13:25:44

209 Views

A string is accepted by an Non-deterministic Push down Automata (NPDA), if there is some path (i.e., sequence of instructions) from the start state to a final state that consumes all the letters of the string. Otherwise, the string is rejected by the NPDA.The language of an NPDA is the set of all strings that it accepts.An input string rejected by the NPDA under following conditions −If reading an input string finishes without reaching a final state.If for a current state/symbol on the stack/input symbol there is no transition.If it attempts to pop the empty stack.ExampleBuild an NPDA which recognises ... Read More

Explain non-deterministic push down automata in TOC?

Bhanu Priya
Updated on 15-Jun-2021 13:23:41

7K+ Views

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 OutWhat 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 ... Read More

What is a context sensitive language in TOC?

Bhanu Priya
Updated on 15-Jun-2021 13:21:25

4K+ Views

A context-sensitive grammar whose productions are of the formαAβ → αγβWhere α, β ∈ (N ∪ T)*, A ∈ N; γ ∈ (N ∪ T)+ and a rule of the form S → λ is allowed if the start symbol S do not appear on the right hand side of any rule.The language generated by such a grammar is called a context-sensitive language.Every context-free grammar is also context-sensitive =⇒ the context-free languages are a subset of the context-sensitive languages (see Chomsky Normal Form).But, not every context-sensitive language is context-free.ExampleThe language {anbncn, n > 1} is context-sensitive but not context free.A ... Read More

What are the restrictions of regular grammar?

Bhanu Priya
Updated on 15-Jun-2021 13:11:38

649 Views

A regular grammar is the one where each production takes one of the following restricted forms −B → ∧, B → w, B → A, B → wA.(Where A, B are non-terminals and w is a non-empty string of terminals.)Restrictions of regular grammarOnly one nonterminal can appear on the right-hand side of a production.Nonterminal must appear on the right end of the right-hand side.Therefore, the productions are as follows −A → aBc and S → TUThese are not part of a regular grammar, but the production A → abcA is.Things like A → aB|cC are allowed because they are actually ... Read More

Design a DFA that accepts at most 3 a"s

Bhanu Priya
Updated on 15-Jun-2021 12:51:13

11K+ Views

Construct deterministic finite automata that accepts at most 3 a’s over an alphabet ∑={a,b}.At most 3 a’s means,The string contains 0 to max 3 a’s and any number of b’s.L= {Є,a,aa,aaa,ab,abb,bab,bbabaa, bbabaabbb,…..}Construct DFALet’s construct DFA step by step −Step 1Valid inputs − aaa, a, aa,ε .Step 2Valid inputs − b, ba, baa, baaa, bb, bba, bbba,…Step 3Valid input − bab, abba, abbbaa, babba,…Step 4Valid inputs − babab, aabb, aaba, bbbaaba, …Step 5Valid inputs − aaabbb, aaabab, baaaba, …Step 6InValid inputs − aaaa, aaabab, baaaba,

Previous 1 ... 5 6 7 8 9 ... 35 Next
Advertisements