Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a . ( 1 0 pts ) Prove that if T ( n ) = 8 n 2 + 2 n + 1 5 ,
a pts Prove that if Tnnn then Tn On Hint: You need to find two
positive constant values c and n such that Tn cn for all n n
b pts Suppose the running time of an algorithm is nmnm m
where n and m are positive integers such that n m Prove that this algorithm is On
c pts Give an analysis of the running time BigOh notation for the following
algorithms:
Firstly calculate Tn and then find a tight upper bound BigOh for each algorithm. You do
not need to provide a proof.
sum ;
i ;
whilei n
sumi;
i;
whilei
sumi;
i;
whilei sqrtn
sumi;
i;
i n;
whilei
sumi;
i;
printsum;
sum ;
i ;
while i n
j ;
while j n
sum i j;
j;
i;
i ;
while i
j ;
while j n
sum i j;
j;
i;
i ;
while i
sum i;
i;
printsum;
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