Suppose that the list of keys is as given in Exercise 21 and that this list is to be sorted using the quick sort algorithm as discussed in this chapter. Use pivot as the median of the first, last, and middle elements of the list.
a. What is the pivot during the second call of the function partitioned?
b. Give the resulting list after two calls to the function partition.
c. What is the size of the list that the function partition partitioned?
d. What are the sizes of the two sublists created by the function partition?
REFERENCE:
Assume the following list of keys:
48, 30, 66, 50, 9, 95, 80, 15, 25, 18, 94, 55, 3, 22, 62
This list is to be sorted using the quick sort algorithm as discussed in this chapter. Use pivot as the median of the first, last, and middle elements of the list. (11)
a. What is the pivot?
b. Give the resulting list after one call to the function partition.
c. What is the size of the list that the function partition partitioned?
d. What are the sizes of the two sublists created by the function partition?
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.