Question: 2. Write a function called add_bitwise(b1, b2) that adds two binary numbers. This function should use recursion to perform the bitwise, elementary-school addition algorithm that

 2. Write a function called add_bitwise(b1, b2) that adds two binary
numbers. This function should use recursion to perform the bitwise, "elementary-school" addition

2. Write a function called add_bitwise(b1, b2) that adds two binary numbers. This function should use recursion to perform the bitwise, "elementary-school" addition algorithm that we discussed in lecture, and it should return the result. It should not perform any base conversions, and it should not call the add_bytes function from Problem 2 Your function should add one pair of bits at a time, working from right to left and including any necessary "carry" bits, as discussed in lecture. For example, when adding 101110 and 100111, you end up with 3 carry bits, as shown in blue below: 101110 + 100111 1010101

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 Databases Questions!