Question: Please Explain, Thanks :) Theory of computation Codes will be compared using document similarity measuring tools. Any evidence of code duplication will lead to an

Please Explain, Thanks :)
 Please Explain, Thanks :) Theory of computation Codes will be compared

Theory of computation Codes will be compared using document similarity measuring tools. Any evidence of code duplication will lead to an 'F' in this assignment or this course You must name your cpp file as _.cpp. Submit your C++ code through Blackboard Consider the regular expression 0(0+1)*01(0+1)*1 over the alphabet (0,1). This regular expression describes strings that begins and ends with the same character A DFA that recognizes this regular expression is given below. Your task is to write a C++ program to implement the given DFA. Your program should also be able to read a long string (consisting of 0's and 1's) contained in a text file. The program must use the DFA implementation to find and print out every substring (of length between 3 and 5) in the text file with their locations which are recognized by the DFA. Note that the same substring may occur more than once in the string. Let's say it occurs twice. If it is accepted by the DFA, it should be printed twice. A test file is provided for you on BlackBoard For example, if the text file contains the string 00010011. The valid substrings (of length between 3 and 5) recognized by the DFA are: 000 at position 1 0 010 at position 3 0 0010 at position 2 0010 at position 2 0100 at position 3 Q2 Q4 Q1 0 1001 at position 4 00010 at position 1 00100 at position 2 0 Q3 Q5 0 10011 at position 4 Note: To find valid substrings, you can't simply check if the substring begins and ends with the same character. The substring must be 'fed' to your DFA implementation. If it ends up in one of the final state, it is valid, otherwise not valid Theory of computation Codes will be compared using document similarity measuring tools. Any evidence of code duplication will lead to an 'F' in this assignment or this course You must name your cpp file as _.cpp. Submit your C++ code through Blackboard Consider the regular expression 0(0+1)*01(0+1)*1 over the alphabet (0,1). This regular expression describes strings that begins and ends with the same character A DFA that recognizes this regular expression is given below. Your task is to write a C++ program to implement the given DFA. Your program should also be able to read a long string (consisting of 0's and 1's) contained in a text file. The program must use the DFA implementation to find and print out every substring (of length between 3 and 5) in the text file with their locations which are recognized by the DFA. Note that the same substring may occur more than once in the string. Let's say it occurs twice. If it is accepted by the DFA, it should be printed twice. A test file is provided for you on BlackBoard For example, if the text file contains the string 00010011. The valid substrings (of length between 3 and 5) recognized by the DFA are: 000 at position 1 0 010 at position 3 0 0010 at position 2 0010 at position 2 0100 at position 3 Q2 Q4 Q1 0 1001 at position 4 00010 at position 1 00100 at position 2 0 Q3 Q5 0 10011 at position 4 Note: To find valid substrings, you can't simply check if the substring begins and ends with the same character. The substring must be 'fed' to your DFA implementation. If it ends up in one of the final state, it is valid, otherwise not valid

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!