Question: Write graf code for a @tm that computes the one's complement of a binary string. Show the simulation with a string of length 1

Write \graf code for a @tm that computes the one's complement of a binary string. Show the simulation with a string of length 10. One's complement is a method of encoding negative numbers. You can compute the One's complement of a binary number as @fllws:
>[1] Flip each bit.
//
//
The @fllwng table shows an encoding @exm for a 4-bit register:
//
//
:fig table
n (binary) # n (decimal) # -n (binary) # -n (decimal)
0000 # 0 # 1111 # -0 # -0!=0
0001 # 1 # 1110 # -1
0010 # 2 # 1101 # -2
0011 # 3 # 1100 # -3
0100 # 4 # 1011 # -4
0101 # 5 # 1010 # -5
0110 # 6 # 1001 # -6
0111 # 7 # 1000 # -7
done.
//
//
[nb] The one's complement on -n produces the number n.
[nb] Only the numbers -7 through 7 can be stored using one's complement with 4 bits.
[nb] One's complement is inconvenient @bc there are 2 different binary strings that represent 0, namely \[0000] and \[1111].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!