Khan.randRange(7, 9) arrSize-1 Khan.randRange(4, arrSizeMinus1) selectionsortPRO.initJSAV(arrSize, sortPos)

In the array of size arrSize displayed below, the element at position sortPos is highlighted. The array represents an intermediate state in Selection sort, with all elements to the left of the highlighted element holding the smallest values in the array.

Perform the next iteration of Selection sort, to put the proper array element into the highlighted position. To swap two elements, click on the first and then click on the second.

[selectionsortPRO.userInput]
if (!selectionsortPRO.checkAnswer(arrSize) && !guess[0]) { return ""; // User did not click, and correct answer is not // initial array state } else { return selectionsortPRO.checkAnswer(arrSize); }

Determine the record that should appear at index sortPos using Selection sort.

Selection sort will place the smallest record in the range [sortPos to arrSizeMinus1] at position sortPos.