Analyzing a QuickSort Method Call
Consider the SortDriver class below. What is the result of executing the main method?
public class SortDriver {
public static void main(String[] args) {
int[] data = {5, 2, 8, 3};
QuickSorter qs = new QuickSorter();
qs.quickSort(data, 0, data.length - 1);
System.out.println(java.util.Arrays.toString(data));
}
}
A
quickSort is executed recursively, sorting the array in ascending order, and the sorted array is printed.
B
Because QuickSort is inherently unstable, the final order of elements may be unpredictable.
C
Due to the static variable, quickSort is executed only once and the array remains unsorted.
D
The output will be the original unsorted array because quickSort is not properly invoked.
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE