I have a question that I am stuck on:
Describe formally (i.e., by means of a transition function) a Turing machine which decides whether the input word a^n has an even or an odd length.
Would someone please be able to enlighten me on what I am being asked to do as I don't really understand it?!
Any help would be much appreciated, thanks.
Not sure if you are still looking for a solution or not, but I found one that solves it in linear time. Here are the transition functions that will produce a 1 on the output tape if even, and 0 otherwise.
x
represents an letter of the given alphabet.I alternate writing 1's and 0's untill we hit the end of the {0,1}* string. Once we hit a blank, we simply return and the value on the output tape is our answer.