# Construct a Turing Machine for a language L = {aibjck | i<j<k or i>j>k} ∩ {aibjck | i>j>k or i>j>k}

• Last Updated : 23 Aug, 2021

Prerequisite – Turing Machine

The language L = {aibjck | i < j < k or i > j > k} ∩ {aibjck | i > j > k or i > j > k} is same as the languages L={aibjck | j > max(i, k)}
In this language, every string of ‘a’, ‘b’ and ‘c’ have certain number of a’s, then certain number of b’s and then certain number of c’s.

• Count of 1st symbols should be atleast 1. ‘b’ and ‘c’ can have thereafter be as many but count of a is less than count of ‘b’ and count of ‘b’ is less than count of ‘c’.
• And, The count of 3rd symbols should be atleast 1. ‘a’ and ‘b’ can have thereafter be as many but count of c is less than count of ‘b’ and count of ‘b’ is less than count of ‘a’
• On Conclusion: Count of 2nd symbol must be greater than max of count of 1st and 3rd symbol and count of 1st and 3rd symbol may or may not be equal
1. Comparing two elements by making two element as a single element.
2. If |Second| is greater than max(|First|, |Third|), then it is accepted.
3. Else it is not accepted.
4. Step-1: Convert A into X and move right and goto step 2. If Y is found ignore it and move right to step-5.

5. Step-2: Keep ignoring A and Y and move towards right. Convert D into Y and move right and goto step-3.
6. Step-3: Keep ignoring D and Z and move towards right. If C is found make it Z and move left to step 4.If B is found ignore it and move left and goto step-8.
7. Step-4: Keep ignoring Z, A, Y and D and move towards left. If X is found ignore it and move right and goto step-1.
8. Step-5: Keep ignoring Y and move towards right. If D is found make it Y and move right to step-6.
9. Step-6: Keep ignoring D and Z and move towards right. Convert C into Z and move left and goto step-7. If B Ignore it move left and goto step-11.
10. Step-7: Keep ignoring D and Z and move towards left. If Y is found ignore it and move right and goto step-5.
11. Step-8: Keep ignoring D, Y and A and move towards left. Ignore X move right and goto step-9. If D ignore and move right and goto step-11
12. Step-9: Convert A into X and move right and goto step-10.
13. Step-10: Keep ignoring Y and A and move towards right. If D make it Y and move right and goto step-8.
14. Step-11: Stop the Machine (String is accepted).
15. Using Q0, when A is found make it X and go to right and to state Q1.And, when Y is found ignore it and go to right and to state Q4
16. On the state Q1, ignore all A and Y and goto right. If D found make it Y and goto right into next state Q2.
17. In Q2, ignore all D, Z and move right. If B found ignore it, move left and goto the state Q4, If C found make it Z move left and to Q3.
18. In Q3 state, ignore all Z, D, Y, A and move left. If X found ignore it move right to Q0.
19. In Q4, ignore all Y and move right. If D is found make it Y and move to right to Q5.
20. In Q5 state, ignore all D, Z and move right. If C found make it Z move left to state Q6.If B is found ignore move left to state Q7
21. In Q6, ignore all D, Z and move left. If Y found ignore it and move right to state Q4.
22. If Q7 state is reached it will produced the result of acceptance of string.
23. In Q8, ignore all A, Y, D and move left. If X found ignore it move right to state Q9. If B is found ignore it and move right to Q11.
24. In Q9 state, if A found make it X move right to state Q10
25. In Q10, ignore all A, Y and move right. If D found make it Y and move right to state Q8.
26. If Q11 state is reached it will produced the result of acceptance of string.
My Personal Notes arrow_drop_up