177k views
0 votes
Which of the following is true about sorting functions?

A. The most optimal partitioning policy for quicksort on an array we know nothing about would be selecting a random element in the array.
B. The fastest possible comparison sort has a worst case no better than O(n log n)
C. Heapsort is usually best when you need a stable sort.
D. Sorting an already sorted array of size n with quicksort takes O(n log n) time.
E. When sorting elements that are expensive to copy, it is generally best to use merge sort.
F. None of the above statements is true.

User Nikolozi
by
4.5k points

1 Answer

2 votes

Answer: Option D -- Sorting an already sorted array of size n with quicksort takes O(n log n) time.

Step-by-step explanation:

Sorting an already sorted array of size n with quicksort takes O(n log n) time is true about sorting functions while other options are wrong.

User Kayle
by
4.4k points