TM - Computation Example The TM here accepts words with two binary numbers (O's and 7's) separated by a letter a. The execution performs a decrement of the second number (OP2) and an increment of the first number (OPI) until the second number becomes zero. • For example, if we want to add 13 and 5 the tape starts with: ■■1101a101 。 The TM would decrement OP2 and increment OP1 five times until erasing OP2 and the addition symbol (a). The resulting tape should display: ■10010 TM - Computation Example input: 1101a101 output: 10010 The execution performs a decrement of the second number (OP2) and an increment of the first number (OPI) until the second number becomes zero. The TM performs: 1. Go to the beginning of OP2; 2. If OP2 is zero go to Step 7; 3. If OP2 is not zero go to the end of OP2; 4. Subtract one from OP2; 5. Go to the end of OP1; 6. Add one to OP1 and return to Step 1; 7. Erase OP2 and addition symbol a; 8. Return the head to the beginning of OP1; 7 8 9 2 3 5 1 6 TM - Computation Example I. Go to the beginning of OP2; J. If OP2 is zero go to State O; K. If OP2 is not zero go to the end of OP2; L. Subtract one from OP2; M. Go to the end of OP1; N. Add one to OP1 and return to State I; OOR 1/1,R R O. Erase OP2 and addition symbol a; P. Return the head to the beginning of OP1; F. Stop the execution. a/e.l input: 1101a101 output: 10010 සිලවලම e/e.R L OOR 1/IR 1/11 1/1,R e/Cl 10.1 018 €/1.R ■ 1101 101 9. Stop the execution.
TM - Computation Example The TM here accepts words with two binary numbers (O's and 7's) separated by a letter a. The execution performs a decrement of the second number (OP2) and an increment of the first number (OPI) until the second number becomes zero. • For example, if we want to add 13 and 5 the tape starts with: ■■1101a101 。 The TM would decrement OP2 and increment OP1 five times until erasing OP2 and the addition symbol (a). The resulting tape should display: ■10010 TM - Computation Example input: 1101a101 output: 10010 The execution performs a decrement of the second number (OP2) and an increment of the first number (OPI) until the second number becomes zero. The TM performs: 1. Go to the beginning of OP2; 2. If OP2 is zero go to Step 7; 3. If OP2 is not zero go to the end of OP2; 4. Subtract one from OP2; 5. Go to the end of OP1; 6. Add one to OP1 and return to Step 1; 7. Erase OP2 and addition symbol a; 8. Return the head to the beginning of OP1; 7 8 9 2 3 5 1 6 TM - Computation Example I. Go to the beginning of OP2; J. If OP2 is zero go to State O; K. If OP2 is not zero go to the end of OP2; L. Subtract one from OP2; M. Go to the end of OP1; N. Add one to OP1 and return to State I; OOR 1/1,R R O. Erase OP2 and addition symbol a; P. Return the head to the beginning of OP1; F. Stop the execution. a/e.l input: 1101a101 output: 10010 සිලවලම e/e.R L OOR 1/IR 1/11 1/1,R e/Cl 10.1 018 €/1.R ■ 1101 101 9. Stop the execution.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 22PE
Related questions
Question
Develop a C++ program that execute the operation as stated by TM for addition of two binary numbers (see attached image).
- Your code should receive two binary numbers and output the resulting sum (also in binary).
- Make sure your code mimics the TM operations (dealing with the binary numbers as a string of characters 1 and 0, and following the logic to increase the first number and decreasing the second one.
Try your TM for the following examples:
- 1101 and 101, resulting 10010; and
- 1101 and 11, resulting 10000.

Transcribed Image Text:TM - Computation Example
The TM here accepts words with two binary numbers (O's and 7's)
separated by a letter a.
The execution performs a decrement of the second number
(OP2) and an increment of the first number (OPI) until the
second number becomes zero.
• For example, if we want to add 13 and 5 the tape starts with:
■■1101a101
。 The TM would decrement OP2 and increment OP1 five
times until erasing OP2 and the addition symbol (a).
The resulting tape should display:
■10010
TM - Computation Example
input:
1101a101
output: 10010
The execution performs a decrement of the second number (OP2) and an
increment of the first number (OPI) until the second number becomes
zero. The TM performs:
1. Go to the beginning of OP2;
2. If OP2 is zero go to Step 7;
3. If OP2 is not zero go to the end of OP2;
4. Subtract one from OP2;
5. Go to the end of OP1;
6. Add one to OP1 and return to Step 1;
7. Erase OP2 and addition symbol a;
8. Return the head to the beginning of OP1;
7
8
9
2
3
5
1
6
TM - Computation Example
I. Go to the beginning of OP2;
J. If OP2 is zero go to State O;
K. If OP2 is not zero go to the
end of OP2;
L.
Subtract one from OP2;
M. Go to the end of OP1;
N.
Add one to OP1 and return
to State I;
OOR
1/1,R
R
O. Erase OP2 and addition
symbol a;
P. Return the head to the
beginning of OP1;
F. Stop the execution.
a/e.l
input:
1101a101
output: 10010
සිලවලම
e/e.R
L
OOR
1/IR
1/11
1/1,R
e/Cl
10.1
018
€/1.R
■ 1101 101
9.
Stop the execution.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning