Question

In: Computer Science

Perform double dabble on the following binary (base 2) numbers: Please show your work for full...

Perform double dabble on the following binary (base 2) numbers: Please show your work for full credit. Either digital or hand written is fine.

1. 10011010010

2. 101010

3. 100111010

4. 10101001101

5. 1100100000

For 10pt extra credit - write a program that implements the double dabble algorithm.

Solutions

Expert Solution

Answer

Steps for double dabble

1) Write the given binary number.

2) Starting from the left, double the previous total and add to the current digit.

3) Double your current total and add the next leftmost digit.

4) Continue doubling the current total until the digit end reaches

1) 10011010010 = 1234

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+0=4

4 x 2+1=9

9 x 2+1=19

19 x 2+0=38

38 x 2+1=77

77 x 2+0=154

154 x 2+0=308

308 x 2+1=617

617 x 2+0=1234

2) 101010= 42

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+1=5

5 x 2+0=10

10 x 2+1=21

21 x 2+0=42

3) 100111010 = 314

solution

   0 x 2+1=1

1 x 2+0=2

2 x 2+0=4

4 x 2+1=9

9 x 2+1=19

19 x 2+0=39

38 x 2+1=78

77 x 2+0=157

157 x 2 +0 =314

4) 10101001101 = 1357

solution

0 x 2+1=1

1 x 2+0=2

2 x 2+1=5

5 x 2+0=10

10 x 2+1=21

21 x 2+0=42

42 x 2+0=84

84 x 2+1=169

169 x 2+1=339

339 x 2+0=678

678 x 2+1=1357

Code for double dabble in python

note:- Please check the spacing before executing

#function for doubledabble
def doubledabble(bin):
#initilaizing the sum
sum=0
#loop for iterating through the binary digit
for i in bin:
#calculating the sum
sum=(sum*2)+int(i);
#printing the result
print("The decimal digit is:- ",sum)
#main code which take input from user
bin=input("Enter the binary digit\n")
#calling the function
doubledabble(bin)

Screenshots

Input\output

  


Related Solutions

represent the decimal number 101 and 6 as floating point binary numbers please show your work...
represent the decimal number 101 and 6 as floating point binary numbers please show your work and explained, I have a test.
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b....
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b. 85 - binary: - hexadecimal: c. 128 - binary: - hexadecimal: d. 4563 - binary: - hexadecimal:
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places...
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places The California Condor (Gymnogyps californianus) is a critically endangered species. In 1991, 48 adults individuals were released in the wild from the captive breeding program. In 2016, there were approximately 323 individuals in existence. 1.Calculate r for this time frame, assuming a continuous and constant growth rate (2 pts). 2.What is the doubling time of this population (2 pts)? 3. 30 rabbits are introduced...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal:...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal: 2. 37 - binary: - decimal: 3. 0A -binary: - decimal: 4. 11 - binary: - decimal:
Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format...
Please show all work: Determine the 2’s complement equivalent of the following numbers in 8-bit format (N.B: You must show your work for full credit)! -12 = -9 =
1a. Convert 67 (base 10) to 8-bit binary using signed magnitude. Show your work. 1b. Convert...
1a. Convert 67 (base 10) to 8-bit binary using signed magnitude. Show your work. 1b. Convert 69 (base 10) to 8-bit binary using one’s complement. Show your work 1c. Convert 70 (base 10) to 8-bit binary using two’s complement. Show your work. 1d. Convert - 67 (base 10) to 8-bit binary using signed magnitude. 1e. Convert - 67 (base 10) to 8-bit binary using ones compliment. Show your work. 1f. Convert - 67 (base 10) to 8-bit binary using 2s...
Identify the Bronsted acid and base in each of the following equations: Please show all work...
Identify the Bronsted acid and base in each of the following equations: Please show all work on how you got the answer so I can understand. HNO3 + H2O
What is (567.12) octal in binary. What is(5CF.AD) hexadecimal in binary. Please show work so I...
What is (567.12) octal in binary. What is(5CF.AD) hexadecimal in binary. Please show work so I can understand how to solve thanks.
In C++ with lots of comments please Complete a binary search tree of 20 numbers Show...
In C++ with lots of comments please Complete a binary search tree of 20 numbers Show in the output the steps while it's performing the search with 20 numbers in a text file called list.txt The numbers will be imported to the program Simple program that should let you have the option to search for numbers, remove numbers, print numbers, and insert numbers in the binary tree If the number isn't there then give an error
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT