Question: Complete function binary _ mul ( a , b ) that computes the product of the binary numbers and using ALGORITHM 1 . 2 .

Complete function binary_mul(a, b) that computes the product of the binary numbers
and
using ALGORITHM 1.2.4 of the "Integer Representations & Algorithms" lecture notes. No credit
will be given to functions that employ any other implementation. The function can not use built-
in functions that already perform some kind of binary representation or addition of binary
numbers. For example, the function implementation can not use the functions bin() or
int(a, base=2).def binary_mul(a,b :
# removing all whitespace from the strings
a= a.replace('','')
b = b.replace('','')
# multiplication algorithm
partial_products =[]
i=0 # tracks the index of the current binary bit of string 'a' beginning at ,r
for bit in reversed(a):
if bit =='1':
partial_products.append("""FIXME: Append the correct object to partial prc
i +=1
result =?''
while len(partial_products)>0 :
result = binary_add("FIXME: Input the correct arguments")
del partial_products[0]
return # FIXME: Return the appropriate result
 Complete function binary_mul(a, b) that computes the product of the binary

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!