- 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

1’s complement means transforming the 0 bit to 1 and the 1 bit to 0.

Let the input be −

B | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | B |

The output is as follows −

B | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | B |

The concept is explained below −

**Step 1** − Start scanning the input from left to right.

**Step 2** − If the R/W is at 1, then make it 0 and move right.

**Step 3** − If the R/W is at 0, then make it 1 and move right.

**Step 4** − Repeat the steps given above and we will reach B (blank).

**Step 5** − Then move the R/W head all the way to the left without changing anything until it reaches the first character.

**Step 6** − The string will be accepted here.

The Turing machine which implements the above-mentioned steps is given below. Here, Q0 is the initial state and Q2 is the final state.

q0 state is to replace ‘1’ with ‘0’ and ‘0’ with ‘1’ and it moves to the right, whenever the BLANK is reached, moves towards the left.

Using state ‘q2’ we reach the start of the string, whenever the BLANK is reached, move towards right and reach the final state q2.

- Related Questions & Answers
- Draw a Turing machine to find 2’s complement of a binary number
- 1’s and 2’s complement of a Binary Number?
- Design a Moore machine to generate 1's complement of a binary number.
- Design Turing Machine to reverse string consisting of a’s and b’s
- 10’s Complement of a decimal number?
- Previous number same as 1’s complement in C++
- C Program to find two’s complement for a given number
- Construct a Turing machine for adding 2 to the binary natural number?
- One’s Complement
- Two’s Complement
- Design a DFA machine accepting odd numbers of 0’s or even numbers of 1’s
- 1's Complement vs 2's Complement
- Count the number of 1’s and 0’s in a binary array using STL in C++
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find 1's and 2's complement of 16-bit number

Advertisements