Found 1163 Articles for Computers

Design Turing Machine to reverse string consisting of a’s and b’s

Bhanu Priya
Updated on 14-Jun-2021 16:05:02

5K+ Views

Our aim is to design a Turing machine (TM) to reverse a string consisting of a’s and b’s over an alphabet {a, b}.ExampleInput − aabbabOutput − babbaaAlgorithmStep 1: Move to the last symbol, replace x for a or x for b and move right to convert the corresponding B to          „a‟ or „b‟ accordingly. Step 2: Move left until the symbol left to x is reached. Step 3: Perform step 1 and step 2 until „B‟ is reached while traversing left. Step 4: Replace every x to B to make the cells empty since the reverse ... Read More

C Program to construct DFA accepting odd numbers of 0s and 1s

Bhanu Priya
Updated on 14-Jun-2021 16:02:12

9K+ Views

Construct deterministic finite automata (DFA) for the language L = { w : w has odd number of 0’s and w has odd number of 1’s}, over the alphabet Σ = {0, 1}.Example0111, 010101, 01110011 is an accepted string, because those strings have an odd number of 0’s and an odd number of 1’s.For the given language we will need four states to draw the main DFA which will read odd no. of 0s and 1s. We can also draw it by merging the two DFAs in which one will accept only an odd number of 0s and one accepts ... Read More

Construct ∈-NFA of Regular Language L = {ab,ba}

Bhanu Priya
Updated on 14-Jun-2021 15:57:35

3K+ Views

The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from input set Σε-NFA is defined in five tuple representation{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA and NFA with epsilon both are almost the same; the only difference is their transition function.NFA transition function is as follows −δ − Q X Σ→ 2QNFA with ε- transition functions is as follows −δ: Q × (Σ∪ε)→2QConstruct NFA ... Read More

Construct a Turing Machine for L = {a^n b^n | n>=1}

Bhanu Priya
Updated on 14-Jun-2021 15:53:29

31K+ Views

The Turing machine (TM) is more powerful than both finite automata (FA) and pushdown automata (PDA). They are as powerful as any computer we have ever built.Formal Definition of Turing MachineA Turing machine can be formally described as seven tuples(Q, X, Σ, δ, q0, B, F)Where, Q is a finite set of statesX is the tape alphabetΣ is the input alphabetδ is a transition function: δ:QxX→QxXx{left shift, right shift}q0 is the initial stateB is the blank symbolF is the final state.A Turing Machine (TM) is a mathematical model which consists of an infinite length tape divided into cells on which ... Read More

Construct a ∈-NFA for the language L = (a* + b*)

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

4K+ Views

The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from input set Σε-NFA is defined in five-tuple representation{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA without ε transitionNFA is defined in five tuple representation{Q, q0, Σ, δ, F}Where, δ − Q X Σ→ 2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA ... Read More

Design a TM for an equal number of a’s and b’s must follow a

Bhanu Priya
Updated on 10-Mar-2022 09:47:49

4K+ Views

The Turing machine (TM) is more powerful than both finite automata (FA) and pushdown automata (PDA). They are as powerful as any computer we have ever built.Formal Definition of Turing MachineA Turing machine can be formally described as seven tuples(Q, X, Σ, δ, q0, B, F)Where, Q is a finite set of statesX is the tape alphabetΣ is the input alphabetδ is a transition function: 𝛿:QxX→QxXx{left shift, right shift}q0 is the initial stateB is the blank symbolF is the final state.A Turing Machine (TM) is a mathematical model which consists of an infinite length tape divided into cells on which ... Read More

C program for DFA accepting all strings over w ∈(a,b)* containing “aba” as a substring

Bhanu Priya
Updated on 14-Jun-2021 15:32:55

3K+ Views

ProblemDesign a DFA for the language L={w1abaw2 | w1, w2 Є(a, b)*}, which means the DFA accepts all strings which contain “aba” as a substring.SolutionThe strings that are accepted by language L= {aba, aabaa, aabab, babab, ababa, …….}Step 1 − Transition diagram for minimal string (starting string) −If w1 and w2 are null then the string it generates is “aba” because w1, w2 ε(a, b)*q0 is the initial state and q3 is the final state.Step 2 − The final DFA for the given language is as follows −Explanationqo is the initial state q0 on ‘a’ goes to q1 and on ... Read More

Construct ∈-NFA of Regular Language L = b + ba*

Bhanu Priya
Updated on 14-Jun-2021 15:28:02

6K+ Views

The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from the input set Σ.ε-NFA is defined in 5 tuples representation{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of states∑ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA without ε transitionNFA is defined in 5 tuples representation{Q, q0, Σ, δ, F}Where, δ − Q X Σ→ 2QQ − Finite set of states∑ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − ... Read More

Construct ∈-NFA of Regular Language L = (0+1)*(00+ 11)

Bhanu Priya
Updated on 14-Jun-2021 15:24:11

22K+ Views

The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from input set Σε-NFA is defined in five tuple{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA without ε transitionNFA is defined in 5 tuple representation{Q, q0, Σ, δ, F}Where, δ − Q X Σ→ 2QQ − Finite set of statesΣ, − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA ... Read More

C Program to construct a DFA which accepts L = {aN | N ≥ 1}

Bhanu Priya
Updated on 14-Jun-2021 15:19:30

883 Views

Let us take a string S of size N, we have to design a Deterministic Finite Automata (DFA) for accepting the language L = {aN | N ≥ 1}.The string accepting the language L is {a, aa, aaa, aaaaaaa…, }.Now the user has to enter a string, if that string is present in the given language, then print “entered string is Accepted”. Otherwise, print “entered string is not Accepted”.DFA transition diagram for the given language is −ExampleFollowing is the C program to construct DFA which accepts the language L = {aN | N ≥ 1} −#include int main() {    char S[30]; ... Read More

Advertisements