Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a.How do one’s complement and two’s complement differ as representations of nega

ID: 3837322 • Letter: A

Question

a.How do one’s complement and two’s complement differ as representations of negative numbers in binary?

b.Write a regular expression that describes all negative numbers represented as two’s complement in binary.

c. Are all regular languages decidable? Why or why not?

b) (5 points) Write a regular expression that describes all strings that end in the se- quence 10 where 10, 1,2 c) (5 points) How do one's complement and two's complement differ as representations of negative numbers in binary? d) (5 points) Write a regular expression that describes all negative numbers represented as two's complement in binary.

Explanation / Answer

a) Let us consider some string of bits in binary as : 11110000.

negitive number representation in 1's complement:

In 1's complement either it is positive or negitive Ones' complement means reversing all the bits in the number.

11110000 ---> 00001111.

negitive number representation in 2's complement:

Let us take above string as negitive then by adding extra sign bit it will be as: 111110000

2's complement of abive string is as follows:

1st convert that number into 1's complement = 000001111
then add 000000001 to it.

000001111
000000001
..............
000010000


c. Let us consider a turing machine where you have input written over a tape you can only but read only the input and not modify it. In addition to that you can only visit the length of the tape where the input is written. This gives you a finite number of configurations to traverse. Thus after a finite number of moves you can Decide whether or not the word belongs to the input language making regular languages decidable