
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Construct a Turing machine for L = {aibjck | i*j = k; i, j, k ≥ 1}
Here we will see how to make a Turing machine for language L = {AiBjCk | i * j = k; i, j, k ≥ 1}. So this represents a kind of language where we will use only three characters A, B and C. The w is a string. So if w = AABBBBCCCCCCCC, The Turing machine will accept it.
To solve this, we will use this approach.
First replace an A with x and move right. Then skip all the A’s and move right
When the head reach to the first B then replace one B with y, then move right skipping all intermediate B’s and corresponding to the replaced B now replace one C with z and move left.
Now move towards left skipping all z and B in the way.
When pointer reach the recent y, then move right.
If the pointer is pointing at B then repeat steps 2 to 4, otherwise when pointer is pointing at z then move towards left while replacing all y to B and skipping all A’s.
When pointer comes to most recent x move to step right.
If the pointer is still pointing to A then repeat all above steps, otherwise when the head is at y then move towards right skipping all y and z.
When $ is reached then move left. String is accepted.
State Transition Diagram
- Related Articles
- Construct a Turing machine for L = {aibjck | i>j>k; k ≥ 1}
- Construct a Turing machine for L = {aibjck | i< j< k; i ≥ 1}
- Maximize arr[j] – arr[i] + arr[l] – arr[k], such that i < j < k < l in C++
- Construct a Turing Machine for language L = {0n1n2n | n≥1}
- Find maximum sum of triplets in an array such than i < j < k and a[i] < a[j] < a[k] in Python
- Find maximum sum of triplets in an array such than i < j < k and a[i] < a[j] < a[k] in C++
- Minimize (max(A[i], B[j], C[k]) – min(A[i], B[j], C[k])) of three different sorted arrays in Python
- Minimize (max(A[i], B[j], C[k]) – min(A[i], B[j], C[k])) of three different sorted arrays in C++
- Construct a Turing Machine for language L = {wwr | w ∈ {0, 1}}
- Construct a Turing Machine for L = {a^n b^n | n>=1}
- Count frequency of k in a matrix of size n where matrix(i, j) = i+j in C++
- Construct a Turing Machine for language L = {ww | w ∈ {0,1}}
- Construct Turing machine for L = {an bm a(n+m) - n,m≥1} in C++
- Count the triplets such that A[i] < B[j] < C[k] in C++
- Program to find a pair (i, j) where nums[i] + nums[j] + (i -j) is maximized in Python?
