Question: Exercise 1: (5+5=10 points) In this exercise, we assume that the function PARTITION is not randomized, and always uses x = A[r] as the pivot.

 Exercise 1: (5+5=10 points) In this exercise, we assume that the

Exercise 1: (5+5=10 points) In this exercise, we assume that the function PARTITION is not randomized, and always uses x = A[r] as the pivot. We also assume that the first element of an array has index 1. Question 1.1: For the array A = [ 8 4 -2 9 5 7 ], give the returned value of PARTITION(A, 2,6) as well as the array A when this function terminates. Question 1.2: Now, suppose that we want to sort A = [ 3 4 -2 9 5 1 ] by increasing order using Quicksort. Give the list of all the calls to QUICKSORT and PARTITION that occur in that process, as well as the array A when each call to PARTITION terminates

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!