Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.) Analyze the running time of Randall-Sort by stating and solving the appropriate recurrence. If you use the master theorem, state the values of a,

image text in transcribed1.) Analyze the running time of Randall-Sort by stating and solving the appropriate recurrence. If you use the master theorem, state the values of a, b, and d, and which case you are using. Give your answer in big O notation.

2.) Does the algorithm sort correctly? If yes, justify your answer. If no, give an example A that the algorithm does not sort correctly.

Could you give me answers for above 2 questions? Thanks very much :)

= 3: 4: 5: 6: Algorithm 1 Professor Randall's new sorting algorithm 1: procedure RANDALL-SORT(A) 2: if |A| = 1 then return RANDALL-SORT(A[1...n/2]) RANDALL-SORT(A[n/2+1...n]) for it 1 to n/2 do 7: if A[i] > A[i+ n/2 then SWAP(A, 1, i + n/2) RANDALL-SORT(A[1...n/2]) RANDALL-SORTA[n/2 +1...n) 11: procedure SWAP(A,1,1) 12: tmp = A[i] A[i] + A[j] A[j] = tmp n 8: 9: 10: 13: 14

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

Step: 3

blur-text-image

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

=+ What are the information and consultation requirements?

Answered: 1 week ago

Question

=+ Should the MNE belong (why, why not)?

Answered: 1 week ago