I think this Turing Machine for a^k b^k k>=0 is correct:
But if I need a^k b^k a^k b^k k>=0, is it correct the same picture? Or this:
I think this Turing Machine for a^k b^k k>=0 is correct:
But if I need a^k b^k a^k b^k k>=0, is it correct the same picture? Or this:
Maybe I am overthinking this, but my solution for the second problem would be (with hopefully somewhat self-explaining node names)
$$\text{INIT}\stackrel{\$,\$,-}\longrightarrow \text{ACCEPT}$$ to account for $k=0$, and $$\text{INIT}\stackrel{a,\$,R}\longrightarrow Q_1=\epsilon\stackrel{a,\$,R}\longrightarrow Q_1=a\stackrel{a,\$,R}\longrightarrow Q_1=aa\stackrel{a,\$,R}\longrightarrow Q_1=aaa\stackrel{b,a,R}\longrightarrow Q_2=aa\stackrel{b,a,R}\longrightarrow Q_2=ab\stackrel{b,a,R}\longrightarrow Q_2=bb\stackrel{a,b,R}\longrightarrow Q_3=b\stackrel{a,b,R}\longrightarrow Q_3=a\stackrel{b,a,R}\longrightarrow Q_4\stackrel{\$,\$,L}\longrightarrow \text{RETURN}\stackrel{\$,\$,R}\longrightarrow\text{INIT}$$ together with loops $$ Q_1=aaa\stackrel{a,a,R}\longrightarrow Q_1=aaa,\quad Q_2=bb\stackrel{b,b,R}\longrightarrow Q_2=bb,\quad Q_3=a\stackrel{a,a,R}\longrightarrow Q_3=a,\quad Q_4\stackrel{b,b,R}\longrightarrow Q_4,\quad \text{RETURN}\stackrel{a,a,L}\longrightarrow\text{RETURN},\quad \text{RETURN}\stackrel{b,b,L}\longrightarrow\text{RETURN}$$ to turn $a^xb^ya^zb^w$ into $a^{x-1}b^{y-1}a^{z-1}b^{w-1}$ and return to the beginning provided $x,y,z,w\ge 4$. In order to account for $aaabbbaaabbb$, we also need $$ Q_1=aa\stackrel{b,\$,R}\longrightarrow\text{need }b^2a^3b^3\stackrel{b,\$,R}\longrightarrow\text{need }ba^3b^3\stackrel{b,\$,R}\longrightarrow\text{need }a^3b^3\stackrel{a,\$,R}\longrightarrow\text{need }a^2b^3\stackrel{a,\$,R}\longrightarrow\text{need }ab^3\stackrel{a,\$,R}\longrightarrow\text{need }b^3 \stackrel{b,\$,R}\longrightarrow\text{need }b^2\stackrel{b,\$,R}\longrightarrow\text{need }b\stackrel{b,\$,R}\longrightarrow\text{need }\$\stackrel{\$,\$,-}\longrightarrow\text{ACCEPT}$$ as well as for $aabbaabb$ $$Q_1=a\stackrel{b,\$,R}\longrightarrow\text{need }ba^2b^2\stackrel{b,\$,R}\longrightarrow\text{need }a^2b^2 \stackrel{a,\$,R}\longrightarrow\text{need }ab^2\stackrel{a,\$,R}\longrightarrow\text{need } b^2$$ and finally for $abab$ $$Q_1=\epsilon \stackrel{b,\$,R}\longrightarrow\text{need } ab \stackrel{a,\$,R}\longrightarrow\text{need } b.$$