CJCoding With Joseph
15free / daySign inCreate account

Selection Sort

Write selection_sort(values: list[int]) -> None that sorts the list in place: for each position i from the front, find the index smallest of the least value from i to the end with an inner loop, then swap the values at i and smallest through a temp variable. The inner loop scans the whole unsorted part every time, so this is O(n squared) even on sorted input. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one line of space-separated integers (possibly empty); the tests call your function and then print the list.

Expected Output:

[11, 12, 22, 25, 64]

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Data Structures & AlgorithmsBig-O
📥 Auto-Input:
64 25 12 22 11\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.