Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only answer #4. I finished #3. (1 point) 3. Let t1 = a + (b-a)/3] and t2 = b-f(b-a)/31 denote the indices at one third

Only answer #4. I finished #3.

image text in transcribed

(1 point) 3. Let t1 = a + (b-a)/3] and t2 = b-f(b-a)/31 denote the indices at one third and two thirds the way from a to b, respectively. Let pairsort(X,Y) be a function that returns Y|X if X and Y are both odd and X Y, otherwise returns XY. Below is another self-reduction for the ODDSORT problem. State a recursive algorithm using pseudocode for solving the ODDSORT problem based on this self-reduction. pairsort(A[a], A[b]) if a b if b=a+1 if b> a+1 A SOS(Aa...b]) = with A' A" A" - - - SOS(Aa... t2] || At2 +1...b] A'[a... t] || SOS(A' (t1 +1...b]) SOS(A"[a...tz] || A"(t2 +1...b] (2+2 points) 4. Using the same reduction as in item 3 above, state a recurrence T'(n) that expresses the worst case running time of the recursive algorithm. From this recurrence, find a tight (Big-Theta) expression for T'(n). Hint: the Master Theorem may be the easiest solution (1 point) 3. Let t1 = a + (b-a)/3] and t2 = b-f(b-a)/31 denote the indices at one third and two thirds the way from a to b, respectively. Let pairsort(X,Y) be a function that returns Y|X if X and Y are both odd and X Y, otherwise returns XY. Below is another self-reduction for the ODDSORT problem. State a recursive algorithm using pseudocode for solving the ODDSORT problem based on this self-reduction. pairsort(A[a], A[b]) if a b if b=a+1 if b> a+1 A SOS(Aa...b]) = with A' A" A" - - - SOS(Aa... t2] || At2 +1...b] A'[a... t] || SOS(A' (t1 +1...b]) SOS(A"[a...tz] || A"(t2 +1...b] (2+2 points) 4. Using the same reduction as in item 3 above, state a recurrence T'(n) that expresses the worst case running time of the recursive algorithm. From this recurrence, find a tight (Big-Theta) expression for T'(n). Hint: the Master Theorem may be the easiest solution

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Influences on Nonverbal Communication?

Answered: 1 week ago