Question: Consider the following algorithm which receives as input two numbers and and sets to times ; div is the integer division operator. 0 repeat

Consider the following algorithm which receives as input two numbers and and sets
to \times ; div is the integer division operator.
0
repeat
if is odd then
+
div 2
+
until <1:
State (as a function of and ) how many times the loop is executed and justify your
answer.
Give the running time of the algorithm in \Theta notation as a function of and . Explain
how you reached the answer.

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