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

Data Structure AlgorithmsComputer ScienceComputers

Problem

Construct DFA which accepts a string that contains second symbol is zero and fourth symbol is 1 over an alphabet ∑={0,1}.

Solution

Input − 00110

Output is accepted; because in the given string the second symbol is ‘0’ and the fourth symbol is ‘1’.

Input − 11001

Output − string is not accepted, because the second symbol is not ‘0’.

Design DFA step by step as given below −

Step 1 -

Valid inputs − 0001

Step 2 -

Valid input − 1001

Step 3 -

Valid inputs − 0011, 1011

Step 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, …

raja
Published on 15-Jun-2021 12:44:42
Advertisements