Question: You are given the following algorithm: Algorithm whatIsThis ( A [ 0 . . . n - 1 ] ) mergesort ( A ) i
You are given the following algorithm:
Algorithm whatIsThisAn
mergesortA
i
while i n do
while i n and Ai Ai do
i i
Bi Ai
i i
return B
a What is the purpose of this algorithm?
b There is one logical error in this algorithm. Find and correct it
c What is the complexity of this algorithm? Explain your reasoning.
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
