[Solved]C 113 Sorting Algorithm Stooge Sort Named Comedy Team Three Stooges Input Size N 1 2 Algor Q37122783

C-11.3 There is a sorting algorithm, “Stooge-sort,” which is named after the comedy team, “The Three Stooges.” if the input size, n, is 1 or 2, then the algorithm sorts the input immediately. Otherwise, recursively sorts the first 2n/3 elements, then the last 2n/3 elements, and then the first 2n/3 elements again. The details are shown in Algorithm 11.5. Show that Stooge-sort is correct and characterize the running time, T(n), for Stooge-sort, using a recurrence equation, and use the master theorem to determine an asymptotic bound for T(n) Algorithm StoogeSort(A, i,j) Input: An array, A, and two indices, i and j, such that 1 si <j< n Output. Subarray, AI..JI, sorted in nondecreasing order n ← J-1+ 1 if n 2 then // The size of the subarray we are sorting if Ali > Alj then Swap Ali and Aj] else if n >2 then StoogeSort(A, i, j – m) ISort the first part StoogeSort(A, i m, j) IlSort the last part StoogeSort (A, i, j – m) I Sort the first part again return A Algorithm 11.5: Stooge-sort. Show transcribed image text C-11.3 There is a sorting algorithm, “Stooge-sort,” which is named after the comedy team, “The Three Stooges.” if the input size, n, is 1 or 2, then the algorithm sorts the input immediately. Otherwise, recursively sorts the first 2n/3 elements, then the last 2n/3 elements, and then the first 2n/3 elements again. The details are shown in Algorithm 11.5. Show that Stooge-sort is correct and characterize the running time, T(n), for Stooge-sort, using a recurrence equation, and use the master theorem to determine an asymptotic bound for T(n) Algorithm StoogeSort(A, i,j) Input: An array, A, and two indices, i and j, such that 1 si 2 then StoogeSort(A, i, j – m) ISort the first part StoogeSort(A, i m, j) IlSort the last part StoogeSort (A, i, j – m) I Sort the first part again return A Algorithm 11.5: Stooge-sort.
Expert Answer
Answer to C-11.3 There is a sorting algorithm, “Stooge-sort,” which is named after the comedy team, “The Three Stooges.” if the in… . . .
OR

