In: Computer Science
Assume the following list of keys:
78, 40, 16, 82, 64, 67, 57, 40, 37, 47, 72, 14, 17, 27, 55
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.
According to the problem statement,
The answers are as follows,
a) What is the pivot?
Answer: 55
Explanation:
b) Give the resulting list after one call to the partition function?
Answer: 40, 16, 40, 37, 47, 14, 17, 27, 55, 64, 72, 67, 57, 78, 82
Explanation:
I hope the above information and explanation will help you out!
Please comment if you have any queries/errors!
Thank you!