Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 algorithm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain how authentication works.

Answered: 1 week ago

Question

Approaches to Managing Organizations

Answered: 1 week ago

Question

Communicating Organizational Culture

Answered: 1 week ago