Answered step by step
Verified Expert Solution
Question
1 Approved Answer
P 1 . ( 1 0 pts ) Proof by Induction ( Prove the two equations shown below ) . o ( 5 pts )
P pts Proof by Induction Prove the two equations shown below
o pts Let Fi be the Fibonacci numbers as defined below.
F F and Fk Fk Fk
Prove
If you want to type your answer, this notation can above be written as 'Sigma i from to N Fi FN
o pts If n then nn
The caret symbol can be used to raise a value to any power for example, N can be written as N
P pts Use the definition of BigOh to prove that following statement:
If fn is Ogn and gn is Ohn then fn is Ohn
Hint: This statement can be proved easily by finding two constants given in the definition of BigOh
P pts For the following program fragments, give an analysis of the running time using
i
i
sum
while i nn:
sum
i
i
i
sum
while i nn:
sum
i
ii
k
n n k
if n :
k n
else:
for i in rangen:
for j in rangen:
iii
for i in rangen:
for j in rangei n:
if j i:
for k in rangen:
sum
iv
for i in rangen:
for j in rangei n:
if j i:
for k in rangen:
sum
P pts What is the asymptotic complexity of the following functions? Justify your answer.
i
def funn:
sum ;
if n :
return
else:
sum sum funn
for i in rangen:
printend
sum i
return sum
Recurrence Relation:
Complexity in BigOh:
ii
def funa b:
if b :
return
if b :
return funaa b
elif:
return funa ba
Recurrence Relation:
Complexity in BigOh:
iii Assume combineAll is On where n is rightleft
def funa left, right:
if left right:
if aleft:
return aleft
else:
return
center intleft right
caseLeft funa left, center
caseRight funa center right
caseLR funaleftcentercenterright
combineAllcaseLeft caseRight, caseLR # Assume it is On
Recurrence Relation:
Complexity in BigOh:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started