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
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...
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
For any mathematical computations, you must show your work to receive full credit. 2. For a...
For any mathematical computations, you must show your work to receive full credit. 2. For a sample of 900 police officers at a local police department, a researcher believes there is a relationship between “number of arrests per month” and “police use of force.” Using the following data, test the null hypothesis at the .01 level of significance that police use of force does not differ by the number of arrests per month that an officer makes. In so doing,...
Please show all work in full detail. You have been working for your brother (owner of...
Please show all work in full detail. You have been working for your brother (owner of a Down Under Sandwich Shoppe). The franchise company is now offering you a chance to franchise one of their new Big Bird Stick-e-Chicken shops (which sells their honey-roasted chicken-on-a-stick). You estimate your business can gross 45% of Down Under’s $500,000 sales. Shop space is available between Down Under Sandwiches and Little Nero Salads that leases $8,400 a year plus a yearend rent bonus to...
Please read carefully. You must show all of your work for full credit. A correct answer...
Please read carefully. You must show all of your work for full credit. A correct answer with no work shown is worth no points, but an incorrect or partial answer with some work shown may be worth partial credit. Include explanations in each step. Correct format for writing answers (using symbols and letters). Question: What is the probability that fewer than 120 agreed? Answer: P (x < 120) I. An orange juice producer buys oranges from a large orange grove...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT