Question: Consider the following two programs ( where / denotes integer division ) ( a ) . x 0 for k n down to 1 do
Consider the following two programs where
denotes integer division
a x
for k n down to do
p k
while p do
p p
x x
b x
for k to n do
p
s k
while p s do
p p
x x
Assume that arithmetic operations take constant time, no matter the size of the operands. For these two
programs
Estimate the running time of the inner while loop respect to k for program in a and b You
should give a tight bound, of the form Theta fk with f as simple as possible, but you do not need to
justify your answer. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
