- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Design a TM to compute addition of two unary numbers

The unary input number n is represented with a symbol 0 n – times.

## Example

4 → 0000

1 → 0

5 → 00000

The separation symbol, „#‟ (any other special character) shall be used to distinguish between two or more inputs.

For Example: 5, 2 are the inputs represented by 00000 # 00.

## Algorithm

**Step 1 -** Read the symbols of the first input with no replacements and move right.

**Step 2 -** When the symbol = ‘#’, replace it by ‘0’ and move right.

**Step 3 -** Traverse right side until the rightmost ‘0’ (left to B – last symbol)

**Step 4 -** Replace the rightmost ‘0’ by B

**Step 5 -** Stop the machine.

## Turing Machine

The Turing Machine (TM) is as follows −

The Turing machine, M is given by M = (Q, ∑, Γ, δ, q0, B, F)

Where,

Q = {q0, q1, q2, q3}

Σ = {0, #}

Γ = {0, #, B}

δ ⇒ Given by the above transition diagram q

0 = {q0}

B = {B}

F = {q3}

- Related Questions & Answers
- Construct a TM performing multiplication of two unary numbers
- Addition of two numbers without propagating Carry?
- Design a TM which recognizes palindromes over = {a, b}
- Design a TM that increments a binary number by 1
- Program to compute gcd of two numbers recursively in Python
- C++ program to overload addition operator to add two complex numbers
- Design a TM that perform right shift over ∑ = {0, 1}
- Python program addition of two matrix
- Count Unary Numbers in a Range in C++
- What is the addition of binary numbers?
- Design a TM for an equal number of a’s and b’s must follow a
- Addition of multi-byte numbers in Z-80
- Addition of two number using ‘-‘ operator?
- Bitwise recursive addition of two integers in C
- C++ Program to Compute Cross Product of Two Vectors