⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’

Excalidraw Data

Text Elements

10011

19

Question: Reverse the bits.

00000

result

10011

number

00001

&

00001

Add to result and left-shift, right-shift the number

1

00010

result

01001

number

00001

&

00001

2

00110

result

00100

number

00001

&

00000

3

Add to result and left-shift, right-shift the number

Add to result and left-shift, right-shift the number

01100

result

00010

number

00001

&

00000

4

Add to result and left-shift, right-shift the number

11000

result

00001

number

00001

&

00001

5

Add to result and left-shift, right-shift the number

Result = 11001 = 25

Loop Ended.

Remember: If you have 32 bits number, loop will be 32 bits. If you have 64 bits number, loop will be 64.

Here, we have 5 bits, so we have loop of 5.