Problem

Suppose that the list of keys is as given in Exercise 21 and that this list is to be sor...

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?

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT