Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All algorithms are in pseudocode Problem 2. (15p) Consider the following strange sorting algorithm procedure SoMESoRT(A, 1,r) if l+1 then if A]> Afr] then exchange
All algorithms are in pseudocode
Problem 2. (15p) Consider the following "strange" sorting algorithm procedure SoMESoRT(A, 1,r) if l+1 then if A]> Afr] then exchange AAr else if r >11 then SomeSort (A,l,r-p) SomeSort (A,1+p,r) SomeSort (A,l,r-p) 2.1 (2p) Illustrate the behavior of Some Sort on the input A =30, 20, 10] with l = 1 and r = 3 2.2 (6p) Prove that SomeSort correctly sorts any input array A of size n-l-r +1. A sketch of 2.3 (6p) Analyze the efficiency of SomeSort in the worst case. Set up a recurrence relation and 2.4 (1p) Compare the worst case runtime for SomeSort to that of the other sorting algorithms the correctness proof is enough. You can assume that n 3p give a tight asymptotic bound we've learned (selection sort, insertion sort, merge sort). Would you use this algorithm? Problem 2. (15p) Consider the following "strange" sorting algorithm procedure SoMESoRT(A, 1,r) if l+1 then if A]> Afr] then exchange AAr else if r >11 then SomeSort (A,l,r-p) SomeSort (A,1+p,r) SomeSort (A,l,r-p) 2.1 (2p) Illustrate the behavior of Some Sort on the input A =30, 20, 10] with l = 1 and r = 3 2.2 (6p) Prove that SomeSort correctly sorts any input array A of size n-l-r +1. A sketch of 2.3 (6p) Analyze the efficiency of SomeSort in the worst case. Set up a recurrence relation and 2.4 (1p) Compare the worst case runtime for SomeSort to that of the other sorting algorithms the correctness proof is enough. You can assume that n 3p give a tight asymptotic bound we've learned (selection sort, insertion sort, merge sort). Would you use this algorithmStep 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