A program uses selection sort to arrange five distinct test scores in ascending order. Its first pass searches the entire array for the smallest score and swaps that score with the first entry. What is guaranteed immediately after this pass?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A teacher sorts project scores stored as [31, 14, 25, 8, 19] using ascending selection sort. A pass searches the remaining portion for its minimum, then swaps that minimum with the first entry of that portion. If the minimum is already there, no swap occurs. Complete the table with the entire array after each of the first three passes. Enter exact integers.


Five initial project scores appear in array cells indexed from zero through four.


Completed passIndex 0Index 1Index 2Index 3Index 4
1
2
3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

An embedded scoreboard uses ascending selection sort to arrange a batch of scores. A key comparison compares two score values. For a batch of nn scores, the implementation makes exactly n−1n-1 passes, comparing each later score once with the current minimum on each pass. It has no early exit. The batch may use at most 276 key comparisons. What is the largest permitted batch size? Answer in number of scores, as an integer.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice