Will this turing machine accept this language?

74 Views Asked by At

I have to design a turing machine that will accept the language L={w1^n | w∈Σ∗ and w has exactly n distinct symbols from Σ and 1 is not in the alphabet}. My idea is to create a turning machine that has 2 stages, the first checks every element in w is distinct by comparing w1 to w2...wn. It marks each w it has compared to as read and once it sees a 1 it goes back, unmarking all the elements as read till it sees an unmarked element of w (in the first case w1). it then marks w1 and moves on to compare w2 to w3...wn using the same method and repeating till all elements of w are marked. If it sees any elements that are the same it rejects and halts. Once it sees all elements of w are marked it goes back and unmarks them all and starts the second phase, where it simply goes back and forth between elements of w and the 1's, marking each as read to make sure there's the same number and rejecting if not. I don't need an alternative answer if this is not correct, I just am fairly new to turing machines and need to know if this is a valid answer.