Turing machine problem.

240 Views Asked by At

I saw a problem of a Turing machine that seemed interesting to me, it is the following:

Construct a TM that decides if a given word has a even number of 0's and an odd number of 1's.

I wanted to give it a try and see if you guys could help me with the idea I have in mind. For example, if I want to check if a number $n$ is even I check if $n-2$ is, and if I want to check if it is odd I check if $n-2$ is. Well, with that order of ideas, for example, I want to verify if the word 0100100110 has an even number of zeros and an odd number of ones. For that, I delete the zeros two by two (in the Turing machine I mark them with some letter or blank space) and if I don't have any zero left to delete, the number of zeros is even and if I have any zero left, the amount is odd and goes to the state of rejecting the word. Likewise with the ones, if when I delete them I don't have any 1 left, the amount is even and it would go to the rejected state but if I have any one left then the amount is odd and I would accept the word. But how can I translate that idea into a Turing machine, if I can only give it one instruction I can't go erasing two by two zeros but by marking them one by one. Any idea to make the diagram of the machine.