Question: 3. (a) Show and explain clearly what the following array looks like in each step of the partition algorithm. 15 20 12 7 13
3. (a) Show and explain clearly what the following array looks like in each step of the partition algorithm. 15 20 12 7 13 23 11 6 (10 Marks) (b) Continuing from your answer in part (a), show each step in the quicksort algorithm when applied to the array in part (a). (8 Marks) (c) Given an array A with n elements, write an algorithm in pseudo-code to find A[z(i)]. A[T(n-i+1)], where (i) is the index of the i-th smallest element in A. You may make use of functions discussed in lecture to construct your algorithm. What is the time complexity of your algorithm? (7 Marks)
Step by Step Solution
3.53 Rating (160 Votes )
There are 3 Steps involved in it
a Step1 15 20 12 7 13 23 11 6 Step2 15 20 12 7 13 23 11 6 Step... View full answer
Get step-by-step solutions from verified subject matter experts
