Question: Silly-Sort Consider the following sorting algorithm Silly-Sort(A,i,j) if A[i] > A[j] then exchange A[i] and A[j]; if i+1 >= j then return; k = floor((j-i+1)/3);
![Silly-Sort Consider the following sorting algorithm Silly-Sort(A,i,j) if A[i] > A[j]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4629ba613d_05966f4629b2eb28.jpg)
Silly-Sort Consider the following sorting algorithm Silly-Sort(A,i,j) if A[i] > A[j] then exchange A[i] and A[j]; if i+1 >= j then return; k = floor((j-i+1)/3); Silly-Sort(A,i,j-k); Silly-Sort(A, i+k,j); Silly-Sort(A,i,j-k); (a) Argue (by induction) that if n is the length of A, then Silly- Sort(A,1,n) correctly sorts the input array A[1...n] (b) Give a recurrence relation for the worst-case run time of Silly-Sort and a tight bound on the worst-case run time (c) Compare this worst-case runtime with that of insertion sort, merge sort, heapsort and quicksort
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
