Found 1163 Articles for Computers

How to use Turing machines to recognize languages in TOC?

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

1K+ 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

3K+ 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

6K+ 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

8K+ 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

371 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

What are the restrictions of regular grammar?

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

1K+ 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

17K+ 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,

Explain about CYK Algorithm for Context Free Grammar

Bhanu Priya
Updated on 15-Jun-2021 12:48:06

9K+ Views

CKY means Cocke-Kasami-Younger. It is one of the earliest recognition and parsing algorithms. The standard version of CKY can only recognize languages defined by context-free grammars in Chomsky Normal Form (CNF).It is also possible to extend the CKY algorithm to handle some grammars which are not in CNF (Hard to understand).Based on a “dynamic programming” approach −Build solutions compositionally from sub-solutionsIt uses the grammar directly.AlgorithmBegin    for ( i = 1 to n do )    Vi1 { A | A → a is a production where i th symbol of x is a }    for ( j = ... Read More

Design a DFA accepting stringw so that the second symbol is zero and fourth is 1

Bhanu Priya
Updated on 15-Jun-2021 12:45:14

4K+ Views

ProblemConstruct DFA which accepts a string that contains second symbol is zero and fourth symbol is 1 over an alphabet ∑={0,1}.SolutionInput − 00110Output is accepted; because in the given string the second symbol is ‘0’ and the fourth symbol is ‘1’.Input − 11001Output − string is not accepted, because the second symbol is not ‘0’.Design DFA step by step as given below −Step 1 -Valid inputs − 0001Step 2 -Valid input − 1001Step 3 -Valid inputs − 0011, 1011Step 4 -Valid inputs − 00010, 10010, 00110, 00011, 10011, 00111, …Step 5 -Invalid inputs − 0101, 0100, 0010, 1100, 0000, 1000, …Step 6 -Valid inputs − 01010, 01000, 11111, 0100000, …

Explain the intersection process of two DFA’s

Bhanu Priya
Updated on 15-Jun-2021 12:41:39

4K+ Views

According to the theorem, If L and M are two regular languages, then L ∩ M is also regular language.ExampleConstruct A∩B where A and B is given as follows −The language A ={10, 100, 00, 001, 1010, …..}The language B ={01, 1010, 10, 101, …..}AA = (QA, Σ, δA, qa, FA) AB = (QB, Σ, δB, qB, FB) A∩B=(QA x QB ,Σ, δ(qA x qB ,FA x F B )Where, δ(( p, q), a) =δL (p, a), δM (q, a))Here, QA x QB = {p, q} x {r, s}    ={(p, r), (p, s), (q, r), (q, s)} Z = ... Read More

Advertisements