Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Two-way Deterministic Finite Automata


Published on

Published in: Education, Technology
  • Be the first to comment

Two-way Deterministic Finite Automata

  1. 1. Two-way DeterministicFinite Automata<br />(2DFA)<br />Presented By: HafsaNaseem<br />
  2. 2. DFA<br />Input is processed once from left to right. After an input has been read, the DFA decides whether the input is accepted or rejected.<br />2DFA<br /><ul><li>Can read the input back and forth with no limit on how many times an input symbol can be read.
  3. 3. As in the case of DFA, the 2DFA decides whether a given input is accepted or rejected.</li></li></ul><li>Why not 2DFA?<br />Are 2DFA unrealistic?<br />Consumes more memory and time than DFA?<br />Problems that can be solved by DFA cannot be solved by 2DFA?<br />Complex to implement?<br />
  4. 4. What is 2DFA?<br />The concept of 2DFA was originated by Rabin and Scott in 1997 <br />2DFA is a generalized version of the DFA which can revisit characters already processed. <br />
  5. 5. How 2DFA works?<br />Two-way Finite Automata have a read head, which can move left or right over the input string. <br />Consists of the symbols of the input string as occupying cells of a finite tape, one symbol per cell. <br />The input string is enclosed in left and right endmarkers ⊣ and ⊢, which are not elements of the input alphabet Σ.<br />The read head may not move outside of the endmarkers.<br />
  6. 6. Structure of 2DFA <br />
  7. 7. Formal Definition of 2DFA<br />
  8. 8. Function δ takes a state and a symbol as arguments and returns a new state and a direction to move the head. <br />If δ(p, b) = (q, d), then whenever the machine is in state p and scanning a tape cell containing symbol b, it moves its head one cell in the direction d and enters state q.<br />
  9. 9. Example:<br />2DFAs can be seen as read-only Turing machines with no work tape, only a read-only input tape<br />Turing machine<br />Move back and forth in the working tape while reading and/or writing.<br />Has no limit to the amount of memory that it can use.<br />As input becomes more complicated, it may use more memory to compute.<br />
  10. 10. Informal description of a 2DFA accepting the set<br /> A = {x ∈ {a, b}∗ | #a(x) is a multiple of 3 and #b(x) is even}. <br />counting the number of a’s mod 3 and ignoring the b’s. <br />counting the number of b’s mod 2 and ignoring the a’s. <br />
  11. 11. How does DFA compare to 2DFA?<br />The equivalent DFA for a 2DFA may have exponentially more states.<br />2DFA can solve any problems that are solvable by DFA. Next, are there problems that can be solved by 2DFA but cannot be solved by DFA<br />It turns out that 2DFA can be significantly simpler in design for solving the same problem than DFA.<br />
  12. 12. Why not 2DFA?<br />Yes! 2DFA are realistic.<br />Consumes less memory and time than DFA.<br />Problems that can be solved by DFA can be solved by 2DFA<br />Easy to implement/ much more powerful than DFA.<br />
  13. 13. Thank You<br />