Question: Na veSort ( A ) 1 for i = A . length downto 2 for j = i - 1 downto 1 if A [
NaveSort A
for length downto
for downto
if
exchange with
Part I points Correctness
Let A denote the output NaiveSort prove that correct, need prove that terminates and that
where length. order show that actually sorts, what else need prove?
Answer the next two questions and prove inequality
points State precisely a loop invariant for the for loop lines and prove that this loop invariant holds. The loop invariant must useful, must help prove Property Your proof should use the structure the loop invariant proof presented this chapter:
points Loop invariant : answer here
points Initialization: answer here
points Maintenance: answer here
points Termination: answer here
Using the termination condition the loop invariant proved part state a loop invariant for the for loop lines that will help you prove inequality Your proof should use the structure the loop invariant proof presented this chapter:
points Loop invariant : answer here
points Initialization: answer here
points Maintenance: answer here
points Termination: answer here
Part points Running Time
points What the input size? answer here
points What the operation that you will count? answer here
points Let the running time Derive the asymptotic bound for
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
