The Wayback Machine - https://web.archive.org/web/20240607080326/https://www.geeksforgeeks.org/turing-machine-for-multiplication/
Open In App

Turing machine for multiplication

Last Updated : 11 Jun, 2018
Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite – Turing Machine
Problem: Draw a turing machine which multiply two numbers.

Example:

Steps:

  • Step-1. First ignore 0’s, C and go to right & then if B found convert it into C and go to left.
  • Step-2. Then ignore 0’s and go left & then convert C into C and go right.
  • Step-3. Then convert all X into X and go right if 0 found convert it into X and go to left otherwise if C found convert it into B and go to right and stop the machine.
  • Step-4. If then X found convert it into X and go left then C into C and left then Y into Y and left.
  • Step-5. Then if B found convert it into B and right then if Y into 0 and right or if C into C and right and go to step 3 and repeat the process otherwise if 0 found after 4th step then convert it into Y and right then Y into Y and right then C into C and right then 0 into 0 or X into X and right then C into C and right then 0 into 0 and right then B into 0 and left then 0 into 0 and left then C into C and left then 0 into 0 or X into X and left then C into C and left.
  • Step-6. Then repeat the 5th step.

Here, q0 shows the initial state and q1, q2, ….., q10, q11are the transition states and q12shows the final state.
And X, Y, 0, C are the variables used for multiplication and R, L shows right and left.


Previous Article
Next Article

Similar Reads

Turing Machine for subtraction | Set 2
Prerequisite – Turing Machine, Turing machine for subtraction | Set 1 A number is represented in binary format in different finite automatas like 5 is represented as (101) but in case of subtraction Turing Machine unary format is followed . In unary format a number is represented by either all ones or all zeros. For example, 5 will be represented b
2 min read
Turing machine for subtraction | Set 1
Prerequisite - Turing Machine Problem-1: Draw a Turing machine which subtract two numbers. Example: Steps: Step-1. If 0 found convert 0 into X and go right then convert all 0's into 0's and go right.Step-2. Then convert C into C and go right then convert all X into X and go right.Step-3. Then convert 0 into X and go left then convert all X into X a
2 min read
Turing machine for copying data
Prerequisite - Turing Machine Problem - Draw a Turing machine which copy data. Example - Steps: Step-1. First convert all 0's, 1's into 0's, 1's and go right then B into C and go left Step-2. Then convert all 0's, 1's into 0's, 1's and go left then Step-3. If 1 convert it into X and go right convert all 0's, 1's into 0's, 1's and go right then conv
2 min read
Check for integer overflow on multiplication
Given two integer a and b, find whether their product (a x b) exceed the signed 64 bit integer or not. If it exceed print Yes else print No. Examples: Input : a = 100, b = 200 Output : No Input : a = 10000000000, b = -10000000000Output : Yes Approach : If either of the number is 0, then it will never exceed the range.Else if the product of the two
4 min read
Why only subtraction of addresses allowed and not division/addition/multiplication
Why Subtraction is allowed? Two addresses can be subtracted because the memory between the two addresses will be valid memory. Let's assume memory Ptr_1 and ptr_2 valid addresses. It is obvious that memory between these two addresses is valid. Pointer ptr_1 is pointing to 0x1cb0010 memory location and ptr_2 is pointing to 0x1cb0030 memory location.
2 min read
Booth’s Multiplication Algorithm
Booth's algorithm is a multiplication algorithm that multiplies two signed binary numbers in 2's complement notation. Booth used desk calculators that were faster at shifting than adding and created the algorithm to increase their speed. Booth’s algorithm is of interest in the study of computer architecture. Here's the implementation of the algorit
15 min read
Virtualization | A Machine Reference Model
Prerequisite: Introduction to Virtualization When an execution environment is virtualized at unlike levels of the stack of computation then it requires a reference model which defines the interfaces within the level of abstractions, and this level of abstraction hides the details of implementations. This projects an idea that, virtualization techni
3 min read
Relationship between Data Mining and Machine Learning
There is no universal agreement on what "Data Mining" suggests that. The focus on the prediction of data is not always right with machine learning, although the emphasis on the discovery of properties of data can be undoubtedly applied to Data Mining always. So, let's begin with that: data processing may be a cross-disciplinary field that focuses o
3 min read
Create Free Windows Virtual Machine in Azure
A virtual machine may be a file, typically called an image, which behaves like an actual computer. The top user has an equivalent experience on a virtual machine as they might have on dedicated hardware. But in a cloud virtual machine is an operating system image running on the server, we can use a cloud virtual machine in many ways - Development,
2 min read
Article Tags :
Practice Tags :