Question: Show that Algorithm 4 uses O ( q l o g a ) bit operations, assuming that a > d . ALGORITHM 4 Computing div

Show that Algorithm 4 uses O(qloga) bit operations, assuming that a>d.
ALGORITHM 4 Computing div and mod.
procedure division algorithm(a : integer, d : positive integer)
q:=0
r:=|a|
while rd
,r:=r-d
,q:=q+1
while rd
if a0 and r>0 then
r:=d-r
q:=-(q+1)
return is the quotient, r=amodd is the remainder
 Show that Algorithm 4 uses O(qloga) bit operations, assuming that a>d.

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!