Question: ( 1 5 pts ) ( Running time complexity ) Find the running time complexity of the functions f ( n ) with nonnegative integer
ptsRunning time complexity Find the running time complexity of the functions with
nonnegative integer input in the following pseudocode. Give the complexity in the form
for some function and choose a bound as tight as possible eg if it is then you
should write instead of Justify your answers. Note that a computes the
remainder of a when divided by and returns whether Also note that the
time complexity of may or may not be the same as the value of
a
function fn:
for i n:
for ji
printi j
b
function fn:
if n:
return
else:
return fnfnfn
c
function fn:
if n:
return
else:
a
for i n:
a ai
return a ffloorn
Note that floor computes
Hint: Let the running time of be First compute for integer Then
prove by induction that is nondecreasing, ie for Finally, we have
where ~~
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
