?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Selection Sort Algorithm Mechanics

APCSA-PWMBL4

Consider the following array.

int[] nums = {77, 53, 28, 30, 19, 65};

One pass is defined as searching through the remaining elements to determine if a swap should be made. Assume that the algorithm is sorting in ascending order and is using a SELECTION SORT.

What would the array look like after the second pass through the sort?

A
[19, 53, 28, 30, 77, 65]
B
[28, 53, 77, 30, 19, 65]
C
[19, 28, 30, 53, 65, 77]
D
[53, 77, 28, 30, 19, 65]
E
[19, 28, 53, 30, 77, 65]