Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
236 views

Turing Machine and Recursive Language

The document describes a Turing machine, which is a theoretical computing device invented by Alan Turing in 1936. A Turing machine consists of an infinite tape that can be read from and written to by a head. It uses a finite set of states and symbols to simulate computations. The document provides details on the formal definition and components of a Turing machine, provides examples to demonstrate how they work, and discusses their ability to simulate any computable function.

Uploaded by

HARSH RAJ JHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views

Turing Machine and Recursive Language

The document describes a Turing machine, which is a theoretical computing device invented by Alan Turing in 1936. A Turing machine consists of an infinite tape that can be read from and written to by a head. It uses a finite set of states and symbols to simulate computations. The document provides details on the formal definition and components of a Turing machine, provides examples to demonstrate how they work, and discusses their ability to simulate any computable function.

Uploaded by

HARSH RAJ JHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

TURING MACHINE

Turing Machine was invented by Alan Turing in 1936 and it is used to accept Recursive
Enumerable Languages.

A turing machine consists of a tape of infinite length on which read and writes operation can be
performed. The tape consists of infinite cells on which each cell either contains input symbol or a
special symbol called blank. It also consists of a head pointer which points to cell currently being
read and it can move in both directions.

A TM is expressed as a 7-tuple (Q, T, B, ∑, δ, q0, F) where:

 Q is a finite set of states


 T is the tape alphabet (symbols which can be written on Tape)
 B is blank symbol (every cell is filled with B except input alphabet initially)
 ∑ is the input alphabet (symbols which are part of input alphabet)
 δ is a transition function which maps Q × T → Q × T × {L,R}. Depending on its present
state and present tape alphabet (pointed by head pointer), it will move to new state,
change the tape symbol (may or may not) and move head pointer to either left or right.
 q0 is the initial state
 F is the set of final states. If any state of F is reached, input string is accepted.

Basic Model of Turing machine


The turning machine can be modelled with the help of the following representation.

1. The input tape is having an infinite number of cells, each cell containing one input symbol and
thus the input string can be placed on tape. The empty tape is filled by blank characters.
2. The finite control and the tape head which is responsible for reading the current input symbol.
The tape head can move to left to right.

3. A finite set of states through which machine has to undergo.

4. Finite set of symbols called external symbols which are used in building the logic of turing
machine.

Let us construct a Turing machine for L={0n1n | n>=1}

 Q = {q0,q1,q2,q3} where q0 is initial state.


 T = {0,1,X,Y,B} where B represents blank.
 ∑ = {0,1}
 F = {q3}

Transition function δ is given in Table 1 as:


Illustration

Let us see how this turing machine works for 0011. Initially head points to 0 which is underlined
and state is q0 as:

The move will be δ(q0, 0) = (q1, X, R). It means, it will go to state q1, replace 0 by X and head
will move to right as:

The move will be δ(q1, 0) = (q1, 0, R) which means it will remain in same state and without
changing any symbol, it will move to right as:
The move will be δ(q1, 1) = (q2, Y, L) which means it will move to q2 state and changing 1 to
Y, it will move to left as:

Working on it in the same way, the machine will reach state q3 and head will point to B as
shown:

Using move δ(q3, B) = halt, it will stop and accepted.

Note:

 In non-deterministic turing machine, there can be more than one possible move for a
given state and tape symbol, but non-deterministic TM does not add any power.
 Every non-deterministic TM can be converted into deterministic TM.
 In multi-tape turing machine, there can be more than one tape and corresponding head
pointers, but it does not add any power to turing machine.
 Every multi-tape TM can be converted into single tape TM.
Language accepted by Turing machine
The turing machine accepts all the language even though they are recursively enumerable.
Recursive means repeating the same set of rules for any number of times and enumerable means a
list of elements. The TM also accepts the computable functions, such as addition, multiplication,
subtraction, division, power function, and many more.

Example:

Construct TM for the language L ={0n1n} where n>=1.

Solution:

We have already solved this problem by PDA. In PDA, we have a stack to remember the
previous symbol. The main advantage of the Turing machine is we have a tape head which can
be moved forward or backward, and the input tape can be scanned.

The simple logic which we will apply is read out each '0' mark it by A and then move ahead
along with the input tape and find out 1 convert it to B. Now, repeat this process for all a's and
b's.

Now we will see how this turing machine work for 0011.

The simulation for 0011 can be shown as below:

Now, we will see how this turing machine will works for 0011. Initially, state is q0 and head
points to 0 as:

The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A and
head will move to the right as:
The move will be δ(q1, 0) = δ(q1, 0, R) which means it will not change any symbol, remain in
the same state and move to the right as:

The move will be δ(q1, 1) = δ(q2, B, L) which means it will go to state q2, replaced 1 by B and
head will move to left as:

Now move will be δ(q2, 0) = δ(q2, 0, L) which means it will not change any symbol, remain in
the same state and move to left as:

The move will be δ(q2, A) = δ(q0, A, R), it means will go to state q0, replaced A by A and head
will move to the right as:

The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A, and
head will move to right as:
The move will be δ(q1, B) = δ(q1, B, R) which means it will not change any symbol, remain in
the same state and move to right as:

The move will be δ(q1, 1) = δ(q2, B, L) which means it will go to state q2, replaced 1 by B and
head will move to left as:

The move δ(q2, B) = (q2, B, L) which means it will not change any symbol, remain in the same
state and move to left as:

Now immediately before B is A that means all the 0?s are market by A. So we will move right to
ensure that no 1 is present. The move will be δ(q2, A) = (q0, A, R) which means it will go to
state q0, will not change any symbol, and move to right as:

The move δ(q0, B) = (q3, B, R) which means it will go to state q3, will not change any symbol,
and move to right as:
The move δ(q3, B) = (q3, B, R) which means it will not change any symbol, remain in the same
state and move to right as:

The move δ(q3, Δ) = (q4, Δ, R) which means it will go to state q4 which is the HALT state and
HALT state is always an accept state for any TM.

The same TM can be represented by Transition Diagram:

Example:

Construct a turing machine which accepts the language of aba over ∑ = {a, b}.

Solution:

We will assume that on input tape the string 'aba' is placed like this:

The tape head will read out the sequence up to the Δ characters. If the tape head is readout 'aba'
string then TM will halt after reading Δ.

Now, we will see how this turing machine will work for aba. Initially, state is q0 and head points
to a as:
The move will be δ(q0, a) = δ(q1, A, R) which means it will go to state q1, replaced a by A and
head will move to right as:

The move will be δ(q1, b) = δ(q2, B, R) which means it will go to state q2, replaced b by B and
head will move to right as:

The move will be δ(q2, a) = δ(q3, A, R) which means it will go to state q3, replaced a by A and
head will move to right as:

The move δ(q3, Δ) = (q4, Δ, S) which means it will go to state q4 which is the HALT state and
HALT state is always an accept state for any TM.

The same TM can be represented by Transition Table:

States a b Δ
q0 (q1, A, R) – –
q1 – (q2, B, R) –
q2 (q3, A, R) – –
q3 – – (q4, Δ, S)
q4 – – –

The same TM can be represented by Transition Diagram:


Example 1:

Construct a TM for the language L = {0n1n2n} where n≥1

Solution:

L = {0n1n2n | n≥1} represents language where we use only 3 character, i.e., 0, 1 and 2. In this,
some number of 0's followed by an equal number of 1's and then followed by an equal number of
2's. Any type of string which falls in this category will be accepted by this language.

The simulation for 001122 can be shown as below:

Now, we will see how this Turing machine will work for 001122. Initially, state is q0 and head
points to 0 as:

The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A and
head will move to the right as:
The move will be δ(q1, 0) = δ(q1, 0, R) which means it will not change any symbol, remain in
the same state and move to the right as:

The move will be δ(q1, 1) = δ(q2, B, R) which means it will go to state q2, replaced 1 by B and
head will move to right as:

The move will be δ(q2, 1) = δ(q2, 1, R) which means it will not change any symbol, remain in
the same state and move to right as:

The move will be δ(q2, 2) = δ(q3, C, R) which means it will go to state q3, replaced 2 by C and
head will move to right as:

Now move δ(q3, 2) = δ(q3, 2, L) and δ(q3, C) = δ(q3, C, L) and δ(q3, 1) = δ(q3, 1, L) and δ(q3,
B) = δ(q3, B, L) and δ(q3, 0) = δ(q3, 0, L), and then move δ(q3, A) = δ(q0, A, R), it means will
go to state q0, replaced A by A and head will move to right as:
The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A, and
head will move to right as:

The move will be δ(q1, B) = δ(q1, B, R) which means it will not change any symbol, remain in
the same state and move to right as:

The move will be δ(q1, 1) = δ(q2, B, R) which means it will go to state q2, replaced 1 by B and
head will move to right as:

The move will be δ(q2, C) = δ(q2, C, R) which means it will not change any symbol, remain in
the same state and move to right as:

The move will be δ(q2, 2) = δ(q3, C, L) which means it will go to state q3, replaced 2 by C and
head will move to left until we reached A as:

immediately before B is A that means all the 0's are market by A. So we will move right to
ensure that no 1 or 2 is present. The move will be δ(q2, B) = (q4, B, R) which means it will go to
state q4, will not change any symbol, and move to right as:
The move will be (q4, B) = δ(q4, B, R) and (q4, C) = δ(q4, C, R) which means it will not change
any symbol, remain in the same state and move to right as:

The move δ(q4, X) = (q5, X, R) which means it will go to state q5 which is the HALT state and
HALT state is always an accept state for any TM.

The same TM can be represented by Transition Diagram:


Example 2:

Construct a TM machine for checking the palindrome of the string of even length.

Solution:

Firstly we read the first symbol from the left and then we compare it with the first symbol from
right to check whether it is the same.

Again we compare the second symbol from left with the second symbol from right. We repeat
this process for all the symbols. If we found any symbol not matching, we cannot lead the
machine to HALT state.

Suppose the string is ababbabaΔ. The simulation for ababbabaΔ can be shown as follows:

Now, we will see how this Turing machine will work for ababbabaΔ. Initially, state is q0 and
head points to a as:

We will mark it by * and move to right end in search of a as:

We will move right up to Δ as:


We will move left and check if it is a:

It is 'a' so replace it by Δ and move left as:

Now move to left up to * as:

Move right and read it

Now convert b by * and move right as:

Move right up to Δ in search of b as:


Move left, if the symbol is b then convert it into Δ as:

Now move left until * as:

Replace a by * and move right up to Δ as:

We will move left and check if it is a, then replace it by Δ as:

It is 'a' so replace it by Δ as:


Now move left until *

Now move right as:

Replace b by * and move right up to Δ as:

Move left, if the left symbol is b, replace it by Δ as:

Move left till *

Move right and check whether it is Δ


Go to HALT state

The same TM can be represented by Transition Diagram:

Example 3:

Construct a TM machine for checking the palindrome of the string of odd length.

Solution:

Firstly we read the first symbol from left and then we compare it with the first symbol from right
to check whether it is the same.
Again we compare the second symbol from left with the second symbol from right. We repeat
this process for all the symbols. If we found any symbol not matching, we lead the machine to
HALT state.

Suppose the string is 00100Δ. The simulation for 00100Δ can be shown as follows:

Now, we will see how this Turing machine will work for 00100Δ. Initially, state is q0 and head
points to 0 as:

Now replace 0 by * and move right as:

Move right up to Δ as:

Move left and replace 0 by Δ and move left:

Now move left up to * as:


Move right, convert 0 by * and then move right as:

Moved right up to Δ

Move left and replace 0 by Δ as:

Move left till * as:

Move right and convert 1 to * as:

Move left
Since it is *, goto HALT state.

The same TM can be represented by Transition Diagram:

Example 4:

Construct TM for the addition function for the unary number system.

Solution:

The unary number is made up of only one character, i.e. The number 5 can be written in unary
number system as 11111. In this TM, we are going to perform the addition of two unary
numbers.

For example

2+3
i.e. 11 + 111 = 11111

If you observe this process of addition, you will find the resemblance with string concatenation
function.
In this case, we simply replace + by 1 and move ahead right for searching end of the string we
will convert last 1 to Δ.

Input: 3+2

The simulation for 111+11Δ can be shown as below:

Move right up to + sign as:

Convert + to 1 and move right as:

Now, move right

Again move right

Now Δ has encountered, so just move left as:


Convert 1 to Δ

Thus the tape now consists of the addition of two unary numbers.

The TM will look like as follows:

Here, we are implementing the function of f(a + b) = c. We assume a and b both are non zero
elements.

Example 5:

Construct a TM for subtraction of two unary numbers f(a-b) = c where a is always greater than b.

Solution: Here we have certain assumptions as the first number is greater than the second one.
Let us assume that a = 3, b = 2, so the input tape will be:
We will move right to - symbol as perform reduction of a number of 1's from the first number.
Let us look at the simulation for understanding the logic:

Move right up to - as:

Move right and convert 1 to * as:

Now move left

Again move left

Convert 1 to * and move right-hand


Now move right till 1

Convert 1 to * and move left

Convert 1 to * and move

Move right till Δ as:

Now we are in the HALT state.

Thus we get 1 on the input tape as the answer for f(3-2).


The Turing machine will look like this:
Church’s Thesis for Turing Machine
In 1936, A method named as lambda-calculus was created by Alonzo Church in which the
Church numerals are well defined, i.e. the encoding of natural numbers. Also in 1936, Turing
machines (earlier called theoretical model for machines) was created by Alan Turing, that is used
for manipulating the symbols of string with the help of tape.

Church Turing Thesis :


Turing machine is defined as an abstract representation of a computing device such as hardware
in computers. Alan Turing proposed Logical Computing Machines (LCMs), i.e. Turing’s
expressions for Turing Machines. This was done to define algorithms properly. So, Church made
a mechanical method named as ‘M’ for manipulation of strings by using logic and mathematics.

This method M must pass the following statements:

 Number of instructions in M must be finite.


 Output should be produced after performing finite number of steps.
 It should not be imaginary, i.e. can be made in real life.
 It should not require any complex understanding.

Using these statements Church proposed a hypothesis called Church’s Turing thesis that can be
stated as: “The assumption that the intuitive notion of computable functions can be identified
with partial recursive functions.”

In 1930, this statement was first formulated by Alonzo Church and is usually referred to as
Church’s thesis, or the Church-Turing thesis. However, this hypothesis cannot be proved.

The recursive functions can be computable after taking following assumptions:

1. Each and every function must be computable.


2. Let ‘F’ be the computable function and after performing some elementary operations to ‘F’, it
will transform a new function ‘G’ then this function ‘G’ automatically becomes the computable
function.
3. If any functions that follow above two assumptions must be states as computable function.
Recursive Language and Recursive
Enumerable Language
Recursive Language and Recursive Enumerable Language

Before discussing Recursive language and Recursive Enumerable language, let us see what
Turing machine responds for some input string.

 If we have the Turing machine T and it halts and accept the string s.
 The Turing machine T halts and rejects the string s.
 The Turing machine T never halts.

These are the 3 possibilities when we give an input string s to Turing machine T.

Recursive Language

A language L is called recursive or decidable, if there exists a Turing machine T. A recursive


language accepts every string of the language L and rejects every string over some alphabet that
is not in the language. Let L is a language and imagine it as a problem, then we can say a
problem L is called decidable if it is recursive language, and is called undecidable if it not
recursive.

 If string s belongs to Language L then Turing machine accepts it.


 If string s not belongs to Language L then Turing machine halts but it never enters an accepting
state.

Turing machine: The Turing machine is more powerful because it has external memory which
is capable of remembering arbitrary long sequence of input string. Neither finite automata nor
push down automata can be considered as accurate model of general purpose computer, since
they are unable to recognize simple language like L = { 0n 1n 2n | n>=0 }.

Recursive Enumerable Language

In recursively enumerable, if there exists a Turing machine that language L is said to be accepts
it. A language for which an enumeration procedure exist is definitely a recursively enumerable
language. The various recursive languages are also recursively enumerable languages but the
vice versa is not true.
The above figure shows the relationship between recursive and recursively enumerable language.

Some Properties of Recursive and Recursive Enumerable Language

Theorem:

If L is recursive language then its complement L’ is also recursive language.

Proof: Let L be a recursive language that is accepted by Turing machine T, which halts on all
inputs. Now we will construct a Turing machine T s from Turing machine T, the construction is
shown below:

As shown in above figure, the Turing machine T, on input string s enters into accept state then
Turing machine Ts halts without accepting input string w. On the other hand, if Turing machine T
halts without accepting input string w then T s enters into a accept state. Ts accepts those strings
that T do not accept. Thus, we can say Ts recognizes the complement of L.

Theorem:

If L1 and L2 are two recursive languages then the union of L1 and L2 i.e. L1 U L2 is also
recursive.
Proof:

Let T1 and T2 are two Turing machines that recognize L1 and L2. We will construct a Turing
machine T, whose construction is shown below:

T first simulates T1 and T accepts the input s if T1 accepts. If T1 rejects then T simulates T2 and
accepts if T2 accepts. Since both T1 and T2 are two algorithms. T is guaranteed to halt.

Therefore, it is proved that Turing machine T accepts the union of L1 and L2.

Theorem:

The union of any two recursively enumerable language is also recursively enumerable language.

Proof: Let L1 and L2 are two recursively enumerable languages accepted by Turing machine T1
and T2. We will construct a Turing machine T, whose construction is shown below:

The Turing machine T simultaneously simulates T1 and T2 on separate tapes. If either T1 or T2


accepts the input string s then Turing machine T accepts.

Theorem:

L is a language and its complement L’ is recursively enumerable language, then L is also a


recursive language.

Proof: M1 and M2 are the two Turing machines that recognize the language L and its
complement L’. We will construct a Turing machine T, whose construction is shown below:
The Turing machine T simulates in parallel both T1 and T2. The states of T1 and T2 are each
components of the state of Turing machine T. If Turing machine T1 accepts the input string s,
then T also accepts the s. On the other hand, if T2 accepts input string s then T rejects s. Since
input string s is either accepted by L or L’ and we know that exactly one of T1 and T2 will
accept. Thus, T will always output with accept or reject but never say both. Since T is an
algorithm that accepts L so we can say Language L is recursive.

Universal Turing Machine


The Turing Machine (TM) is the machine level equivalent to a digital computer.

It was suggested by the mathematician Turing in the year 1930 and has become the most widely
used model of computation in computability and complexity theory.

The model consists of an input and output. The input is given in binary format form on to the
machine’s tape and the output consists of the contents of the tape when the machine halts

The problem with the Turing machine is that a different machine must be constructed for every
new computation to be performed for every input output relation.

This is the reason the Universal Turing machine was introduced which along with input on the
tape takes the description of a machine M.

The Universal Turing machine can go on then to simulate M on the rest of the content of the
input tape.

A Universal Turing machine can thus simulate any other machine.

The idea of connecting multiple Turing machine gave an idea to Turing −

 Can a Universal machine be created that can ‘simulate’ other machines?


 This machine is called as Universal Turing Machine

This machine would have three bits of information for the machine it is simulating

 A basic description of the machine.


 The contents of machine tape.
 The internal state of the machine.

The Universal machine would simulate the machine by looking at the input on the tape and the
state of the machine.

It would control the machine by changing its state based on the input. This leads to the idea of a
“computer running another computer”.

It would control the machine by changing its state based on the input. This leads to the idea of a
“computer running another computer”.

The schematic diagram of the Universal Turing Machine is as follows −

Introduction to Undecidability
In the theory of computation, we often come across such problems that are answered either 'yes'
or 'no'. The class of problems which can be answered as 'yes' are called solvable or decidable.
Otherwise, the class of problems is said to be unsolvable or undecidable.

Undecidability of Universal Languages:

The universal language Lu is a recursively enumerable language and we have to prove that it is
undecidable (non-recursive).

Theorem: Lu is RE but not recursive.

Proof:

Consider that language Lu is recursively enumerable language. We will assume that L u is


recursive. Then the complement of Lu that is L`u is also recursive. However, if we have a TM M
to accept L`u then we can construct a TM Ld. But Ld the diagonalization language is not RE.
Thus our assumption that Lu is recursive is wrong (not RE means not recursive). Hence we can
say that Lu is RE but not recursive. The construction of M for L d is as shown in the following
diagram:

Undecidable Problem about Turing Machine


In this section, we will discuss all the undecidable problems regarding turing machine. The
reduction is used to prove whether given language is desirable or not. In this section, we will
understand the concept of reduction first and then we will see an important theorem in this
regard.

Reduction

Reduction is a technique in which if a problem P1 is reduced to a problem P2 then any solution


of P2 solves P1. In general, if we have an algorithm to convert an instance of a problem P1 to an
instance of a problem P2 that have the same answer then it is called as P1 reduced P2. Hence if
P1 is not recursive then P2 is also not recursive. Similarly, if P1 is not recursively enumerable
then P2 also is not recursively enumerable.

Theorem: if P1 is reduced to P2 then

1. If P1 is undecidable, then P2 is also undecidable.


2. If P1 is non-RE, then P2 is also non-RE.

Proof:

1. Consider an instance w of P1. Then construct an algorithm such that the algorithm takes
instance w as input and converts it into another instance x of P2. Then apply that algorithm to
check whether x is in P2. If the algorithm answer 'yes' then that means x is in P2, similarly we
can also say that w is in P1. Since we have obtained P2 after reduction of P1. Similarly if
algorithm answer 'no' then x is not in P2, that also means w is not in P1. This proves that if P1 is
undecidable, then P1 is also undecidable.
2. We assume that P1 is non-RE but P2 is RE. Now construct an algorithm to reduce P1 to P2, but
by this algorithm, P2 will be recognized. That means there will be a Turing machine that says
'yes' if the input is P2 but may or may not halt for the input which is not in P2. As we know that
one can convert an instance of w in P1 to an instance x in P2. Then apply a TM to check whether
x is in P2. If x is accepted that also means w is accepted. This procedure describes a TM whose
language is P1 if w is in P1 then x is also in P2 and if w is not in P1 then x is also not in P2. This
proves that if P1 is non-RE then P2 is also non-RE.

Empty and non empty languages:

There are two types of languages empty and non empty language. L et Le denotes an empty
language, and Lne denotes non empty language. Let w be a binary string, and Mi be a TM. If
L(Mj) = Ф then Mi does not accept input then w is in L e. Similarly, if L(Mj) is not the empty
language, then w is in Lne. Thus we can say that

Le = {M | L(M) = Ф}
Lne = {M | L(M) ≠ Ф}

Both Le and Lne are the complement of one another.

Post Correspondence Problem


In this section, we will discuss the undecidability of string and not of Turing machines. The
undecidability of the string is determined with the help of Post's Correspondence Problem (PCP).
Let us define the PCP.

"The Post's correspondence problem consists of two lists of string that are of equal length over
the input. The two lists are A = w1, w2, w3, .... , wn and B = x1, x2, x3, .... xn then there exists a
non empty set of integers i1, i2, i3, .... , in such that,
w1, w2, w3, .... wn = x1, x2, x3, .... xn"

To solve the post correspondence problem we try all the combinations of i 1, i2, i3, .... , in to find
the w1 = x1 then we say that PCP has a solution.

Example 1:

Consider the correspondence system as given below

A = (b, bab3, ba) and B = (b3, ba, a). The input set is ∑ = {0, 1}. Find the solution.

Solution:

A solution is 2, 1, 1, 3. That means w2w1w1w3 = x2x1x1x3

The constructed string from both lists is bab3b3a.


Example 2:

Does PCP with two lists x = (b, a, aba, bb) and y = (ba, ba, ab, b) have a solution?

Solution: Now we have to find out such a sequence that strings formed by x and y are identical.
Such a sequence is 1, 2, 1, 3, 3, 4. Hence from x and y list

Example 3:

Obtain the solution for the following system of posts correspondence problem. A = {100, 0, 1},
B = {1, 100, 00}

Solution: Consider the sequence 1, 3, 2. The string obtained from A = babababb. The string
obtained from B = bababbbb. These two strings are not equal. Thus if we try various
combination from both the sets to find the unique sequence, we could not get such a sequence.
Hence there is no solution for this system.

Example 4:

Obtain the solution for the following system of posts correspondence problem, X = {100, 0, 1},
Y = {1, 100, 00}.

Solution: The solution is 1, 3, 1, 1, 3, 2, 2. The string is

X1X3X1X1X3X2X2 = 100 + 1 + 100 + 100 + 1 + 0 + 0 = 1001100100100


Y1Y3Y1Y1Y3Y2Y2 = 1 + 00 + 1 + 1 + 00 + 100 + 100 = 1001100100100

You might also like